From fc3db6eac42b7609f7dc992551e3718ce0009604 Mon Sep 17 00:00:00 2001 From: Jakub Mikulas Date: Mon, 15 Feb 2021 12:26:47 +0100 Subject: [PATCH] chore: move release check to a standalone file --- .circleci/config.yml | 10 +--------- release-scripts/should-i-release.sh | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 9 deletions(-) create mode 100755 release-scripts/should-i-release.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index c02fe850ce..ba9f4962dc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -325,15 +325,7 @@ jobs: # docker_layer_caching: true - run: name: Should I release? - command: | - echo "Considering these commits:" - git --no-pager log $(git describe --tags --abbrev=0 @^)..@ --pretty=format:'%s' --no-merges - echo "\n---\nChecking for feat, fix or revert commit" - git log $(git describe --tags --abbrev=0 @^)..@ --pretty=format:'%s' --no-merges | grep -Ei "^(feat|fix|revert)" - if [ "$?" = "1" ]; then - echo "No changes to release, stopping" - circleci-agent step halt - fi + command: ./release-scripts/should-i-release.sh - install_github_cli - run: name: Install npm@7 diff --git a/release-scripts/should-i-release.sh b/release-scripts/should-i-release.sh new file mode 100755 index 0000000000..a4d4701369 --- /dev/null +++ b/release-scripts/should-i-release.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# Look at commit messages and stop the release job if it's not needed + +echo "Considering these commits:" +git --no-pager log "$(git describe --tags --abbrev=0 @^)"..@ --pretty=format:'- %s %H' --no-merges + +echo " " +echo "---" +echo "Checking for a feat, fix or revert commit message" + +git log "$(git describe --tags --abbrev=0 @^)"..@ --pretty=format:'%s' --no-merges | grep -Ei "^(feat|fix|revert)" +if [ "$?" = "1" ]; then + echo "No changes to release, stopping" + circleci-agent step halt +fi