Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[semver:minor] Allow CIRCLE_TAG to be used for deployments, fail if no tag or branch. #8

Merged
merged 2 commits into from
Jul 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/commands/deploy-via-git.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ parameters:
type: string
description: Deploy the given branch. The default value is your current branch.
default: "$CIRCLE_BRANCH"
tag:
type: string
description: Deploy the given tag. The default value is your current tag.
default: "$CIRCLE_TAG"
force:
type: boolean
description: Whether or not to force the git push (i.e. `git push -f`). Defaults to false.
Expand All @@ -42,12 +46,22 @@ steps:
command: heroku maintenance:on --app << parameters.app-name >>
- run:
no_output_timeout: << parameters.no_output_timeout >>
name: Deploy branch to Heroku via git push
name: Deploy branch or tag to Heroku via git push
command: |
if << parameters.force >>;then
force="-f"
fi
git push $force https://heroku:$<< parameters.api-key >>@git.heroku.com/<< parameters.app-name >>.git << parameters.branch >>:master

heroku_url = "https://heroku:$<< parameters.api-key >>@git.heroku.com/<< parameters.app-name >>.git"

if [ -z "<< parameters.branch >>" ]; then
git push $force $heroku_url << parameters.branch >>:master
elif [ -z "<< parameters.tag >>" ]; then
git push $force $heroku_url << parameters.tag >>^{}:master
else
echo "No branch or tag found."
exit 1
fi
- when:
condition: << parameters.maintenance-mode >>
steps:
Expand Down
2 changes: 1 addition & 1 deletion src/jobs/deploy-via-git.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
description: >
Quickly and easily take the changes to this branch and deploy them to Heroku automatically with this job.
Quickly and easily take the changes to this branch or tag and deploy them to Heroku automatically with this job.
parameters:
app-name:
description:
Expand Down