mirror of
https://github.com/reecetech/version-increment.git
synced 2025-12-21 14:35:44 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4846cbaf9d | ||
|
|
468208262a | ||
|
|
e5f8667dfc | ||
|
|
2ef15157dd | ||
|
|
0974302def | ||
|
|
67d70b45a4 | ||
|
|
47e175a747 | ||
|
|
8202de8885 | ||
|
|
fa8feb816e |
11
README.md
11
README.md
@@ -81,11 +81,12 @@ Examples:
|
|||||||
|
|
||||||
### 📥 Inputs
|
### 📥 Inputs
|
||||||
|
|
||||||
| name | description | required | default |
|
| name | description | required | default |
|
||||||
| :--- | :--- | :--- | :--- |
|
| :--- | :--- | :--- | :--- |
|
||||||
| scheme | The versioning scheme in-use, either `semver` or `calver` | No | `semver` |
|
| 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` |
|
| 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` |
|
| 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
|
### 📤 Outputs
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ inputs:
|
|||||||
Not applicable to `calver` scheme
|
Not applicable to `calver` scheme
|
||||||
required: false
|
required: false
|
||||||
default: 'patch'
|
default: 'patch'
|
||||||
|
release_branch:
|
||||||
|
description: 'Specify a non-default branch to use for the release tag (the one without -pre)'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
current-version:
|
current-version:
|
||||||
@@ -75,3 +79,4 @@ runs:
|
|||||||
increment: ${{ inputs.increment }}
|
increment: ${{ inputs.increment }}
|
||||||
pep440: ${{ inputs.pep440 }}
|
pep440: ${{ inputs.pep440 }}
|
||||||
scheme: ${{ inputs.scheme }}
|
scheme: ${{ inputs.scheme }}
|
||||||
|
release_branch: ${{ inputs.release_branch }}
|
||||||
|
|||||||
@@ -224,6 +224,22 @@ function init_repo {
|
|||||||
[[ "$output" = *"VERSION=1.2.4-pre.${short_ref}"* ]]
|
[[ "$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" {
|
@test "appends prerelease information in pep440 compatible way when pep440 is true" {
|
||||||
init_repo
|
init_repo
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ default_branch='main'
|
|||||||
if [[ -z "${BATS_VERSION:-}" ]] ; then
|
if [[ -z "${BATS_VERSION:-}" ]] ; then
|
||||||
default_branch="$(git remote show origin | ${grep} 'HEAD branch' | cut -d ' ' -f 5)"
|
default_branch="$(git remote show origin | ${grep} 'HEAD branch' | cut -d ' ' -f 5)"
|
||||||
fi
|
fi
|
||||||
|
# use release_branch if not empty
|
||||||
|
if [[ -n "${release_branch:-}" ]] ; then
|
||||||
|
default_branch="${release_branch}"
|
||||||
|
fi
|
||||||
|
|
||||||
current_ref="${GITHUB_REF:-}"
|
current_ref="${GITHUB_REF:-}"
|
||||||
git_commit="$(git rev-parse --short HEAD | sed 's/0*//')" # trim leading zeros, because semver doesn't allow that in
|
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
|
# the 'pre-release version' part, but we can't use the + char
|
||||||
|
|||||||
Reference in New Issue
Block a user