diff --git a/.github/workflows/release_image.yml b/.github/workflows/release_image.yml index 3d2232b..927b9f2 100644 --- a/.github/workflows/release_image.yml +++ b/.github/workflows/release_image.yml @@ -9,9 +9,10 @@ on: inputs: increment: description: Increment - default: minor + default: "null" type: choice options: + - "null" - major - minor - patch diff --git a/script/release-workflow/git-commit.sh b/script/release-workflow/git-commit.sh new file mode 100755 index 0000000..5f700d5 --- /dev/null +++ b/script/release-workflow/git-commit.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -euo >/dev/null + +if [[ $(git status --porcelain) ]]; then + git add Gemfile.lock VERSION lib/pact/cli/version.rb + git commit -m "chore(release): version ${TAG}" +fi \ No newline at end of file diff --git a/script/release-workflow/next-docker-tag.sh b/script/release-workflow/next-docker-tag.sh index 3c76a34..b86be69 100755 --- a/script/release-workflow/next-docker-tag.sh +++ b/script/release-workflow/next-docker-tag.sh @@ -2,9 +2,15 @@ set -eu -gem_version_from_gemfile_lock() { - grep "pact_broker (" pact_broker/Gemfile.lock | awk -F '[()]' '{print $2}' -} +# If increment in null, then use the existing version number +# and just increase `n` by 1 in semver version x.y.z.n +# as set in .github./workflows/release_image.yml +# as set in script/release.sh +if [ "${INCREMENT:-}" ]; then + if [ "${INCREMENT:-}" != "null" ]; then + bundle exec bump ${INCREMENT:-minor} --no-commit --replace-in $PWD/lib/pact/cli/version.rb > /dev/null + fi +fi gem_version=$(ruby -I lib -e "require 'pact/cli/version.rb'; puts Pact::Cli::VERSION") existing_tags=$(git tag) diff --git a/script/release-workflow/run.sh b/script/release-workflow/run.sh index e91c2cc..249887e 100755 --- a/script/release-workflow/run.sh +++ b/script/release-workflow/run.sh @@ -17,4 +17,5 @@ ${script_dir}/docker-build.sh ${script_dir}/scan.sh ${script_dir}/prepare-release.sh ${script_dir}/docker-push.sh +${script_dir}/git-commit.sh ${script_dir}/git-push.sh