Skip to content

Commit

Permalink
[semver:minor] Allow CIRCLE_TAG to be used for deployments, fail if n…
Browse files Browse the repository at this point in the history
…o tag or branch. (#8)
  • Loading branch information
campbecf authored Jul 31, 2020
1 parent e12de66 commit 99d98f2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
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

0 comments on commit 99d98f2

Please # to comment.