From 2e5dca993e82751ad4a6b69ff9a6aa6eb8c764d0 Mon Sep 17 00:00:00 2001 From: Clifford Campbell Date: Tue, 16 Jun 2020 09:48:16 -0400 Subject: [PATCH 1/2] Allow CIRCLE_TAG to be used for deployments, fail if no tag or branch. --- src/commands/deploy-via-git.yml | 18 ++++++++++++++++-- src/jobs/deploy-via-git.yml | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/commands/deploy-via-git.yml b/src/commands/deploy-via-git.yml index 5f3f9a1..e85a05e 100755 --- a/src/commands/deploy-via-git.yml +++ b/src/commands/deploy-via-git.yml @@ -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 oyur 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. @@ -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: diff --git a/src/jobs/deploy-via-git.yml b/src/jobs/deploy-via-git.yml index 22a1763..60e19a3 100755 --- a/src/jobs/deploy-via-git.yml +++ b/src/jobs/deploy-via-git.yml @@ -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: From 4b2c9cc0fd6d4ed52e15e1b18fd1fecb974a4678 Mon Sep 17 00:00:00 2001 From: Clifford Campbell Date: Mon, 27 Jul 2020 10:04:38 -0400 Subject: [PATCH 2/2] Fix typo. --- src/commands/deploy-via-git.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/deploy-via-git.yml b/src/commands/deploy-via-git.yml index e85a05e..d4aec4d 100755 --- a/src/commands/deploy-via-git.yml +++ b/src/commands/deploy-via-git.yml @@ -26,7 +26,7 @@ parameters: default: "$CIRCLE_BRANCH" tag: type: string - description: Deploy the given tag. The default value is oyur current tag. + description: Deploy the given tag. The default value is your current tag. default: "$CIRCLE_TAG" force: type: boolean