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 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 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