From 2ef15157ddb6f58ce6347d693cfcf866bd08e6f8 Mon Sep 17 00:00:00 2001 From: Phil Jay Date: Sat, 16 Sep 2023 10:06:06 +1000 Subject: [PATCH 1/3] Update README --- README.md | 11 ++++++----- action.yml | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d35199e..c560b10 100644 --- a/README.md +++ b/README.md @@ -81,11 +81,12 @@ Examples: ### 📥 Inputs -| name | description | required | default | -| :--- | :--- | :--- | :--- | -| scheme | The versioning scheme in-use, either `semver` or `calver` | No | `semver` | -| pep440 | Set to `true` for PEP440 compatibility of _pre-release_ versions by making use of the build metadata segment of semver, which maps to local version identifier in PEP440 | No | `false` | -| increment | The digit to increment, either `major`, `minor` or `patch`, ignored if `scheme` == `calver` | No | `patch` | +| name | description | required | default | +| :--- | :--- | :--- | :--- | +| scheme | The versioning scheme in-use, either `semver` or `calver` | No | `semver` | +| pep440 | Set to `true` for PEP440 compatibility of _pre-release_ versions by making use of the build metadata segment of semver, which maps to local version identifier in PEP440 | No | `false` | +| increment | The digit to increment, either `major`, `minor` or `patch`, ignored if `scheme` == `calver` | No | `patch` | +| release_branch | Specify a non-default branch to use for the release tag (the one without -pre) | No | | ### 📤 Outputs diff --git a/action.yml b/action.yml index d280373..7b51a8f 100644 --- a/action.yml +++ b/action.yml @@ -23,7 +23,7 @@ inputs: required: false default: 'patch' release_branch: - description: "Specify a non-main branch to use for the release tag (the one without -prerelease). If empty, will use the default branch for the repo." + description: 'Specify a non-default branch to use for the release tag (the one without -pre)' required: false type: string From e5f8667dfc3b78418015af8dbce6ab936ba37f4b Mon Sep 17 00:00:00 2001 From: Phil Jay Date: Mon, 18 Sep 2023 08:46:35 +1000 Subject: [PATCH 2/3] Add test for `release_branch` --- tests/test_version-increment.bats | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_version-increment.bats b/tests/test_version-increment.bats index e6c1481..f2da4d7 100644 --- a/tests/test_version-increment.bats +++ b/tests/test_version-increment.bats @@ -224,6 +224,22 @@ function init_repo { [[ "$output" = *"VERSION=1.2.4-pre.${short_ref}"* ]] } +@test "does not append prerelease information if on a specified release_branch" { + init_repo + + export current_version=1.2.3 + export GITHUB_REF="refs/heads/releases" + export release_branch="releases" + + run ../../version-increment.sh + + print_run_info + [ "$status" -eq 0 ] && + [[ "$output" != *"PRE_RELEASE_LABEL=pre."* ]] && + [[ "$output" != *"VERSION=1.2.4-pre."* ]] && + [[ "$output" = *"VERSION=1.2.4"* ]] +} + @test "appends prerelease information in pep440 compatible way when pep440 is true" { init_repo From 468208262add5f32d78bd29ebcf3ce7acb1b9d91 Mon Sep 17 00:00:00 2001 From: Phil Jay Date: Mon, 18 Sep 2023 08:55:00 +1000 Subject: [PATCH 3/3] Default variable to blank string --- version-increment.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version-increment.sh b/version-increment.sh index b128562..db956e6 100755 --- a/version-increment.sh +++ b/version-increment.sh @@ -33,7 +33,7 @@ if [[ -z "${BATS_VERSION:-}" ]] ; then default_branch="$(git remote show origin | ${grep} 'HEAD branch' | cut -d ' ' -f 5)" fi # use release_branch if not empty -if [[ -n "${release_branch}" ]] ; then +if [[ -n "${release_branch:-}" ]] ; then default_branch="${release_branch}" fi