diff --git a/action.yml b/action.yml index 8a9bff9..d973031 100644 --- a/action.yml +++ b/action.yml @@ -22,6 +22,10 @@ inputs: Not applicable to `calver` scheme 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." + required: + type: string outputs: current-version: @@ -75,3 +79,4 @@ runs: increment: ${{ inputs.increment }} pep440: ${{ inputs.pep440 }} scheme: ${{ inputs.scheme }} + release_branch: ${{ inputs.release_branch }} diff --git a/version-increment.sh b/version-increment.sh index e3ac75d..b128562 100755 --- a/version-increment.sh +++ b/version-increment.sh @@ -32,6 +32,11 @@ default_branch='main' 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 + default_branch="${release_branch}" +fi + current_ref="${GITHUB_REF:-}" git_commit="$(git rev-parse --short HEAD | sed 's/0*//')" # trim leading zeros, because semver doesn't allow that in # the 'pre-release version' part, but we can't use the + char