mirror of
https://github.com/reecetech/version-increment.git
synced 2025-12-22 15:05:44 +00:00
Merge pull request #23 from ps-jay/main
Introduce test for `release_branch`, & update README
This commit is contained in:
11
README.md
11
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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user