mirror of
https://github.com/reecetech/version-increment.git
synced 2025-12-21 06:25:44 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de5ab041fb | ||
|
|
3ac8392aa4 | ||
|
|
72c1fa6077 | ||
|
|
f21e559797 | ||
|
|
4415fcb6c0 | ||
|
|
4846cbaf9d | ||
|
|
468208262a | ||
|
|
e5f8667dfc | ||
|
|
2ef15157dd | ||
|
|
0974302def | ||
|
|
67d70b45a4 | ||
|
|
47e175a747 | ||
|
|
8202de8885 | ||
|
|
fa8feb816e |
7
.github/workflows/test-and-release.yml
vendored
7
.github/workflows/test-and-release.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Run ShellCheck
|
||||
uses: ludeeus/action-shellcheck@94e0aab03ca135d11a35e5bfc14e6746dc56e7e9 # v1.1.0
|
||||
uses: ludeeus/action-shellcheck@2.0.0
|
||||
with:
|
||||
check_together: 'yes'
|
||||
|
||||
@@ -55,10 +55,9 @@ jobs:
|
||||
scheme: calver
|
||||
|
||||
- name: Release version
|
||||
uses: marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0 # v1.2.1
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: ${{ github.ref_name == github.event.repository.default_branch }}
|
||||
with:
|
||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
draft: false
|
||||
prerelease: false
|
||||
automatic_release_tag: "${{ steps.version-increment.outputs.VERSION }}"
|
||||
tag_name: "${{ steps.version-increment.outputs.VERSION }}"
|
||||
|
||||
13
README.md
13
README.md
@@ -9,7 +9,7 @@
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Get next version
|
||||
uses: reecetech/version-increment@2023.4.1
|
||||
uses: reecetech/version-increment@2023.9.3
|
||||
id: version
|
||||
with:
|
||||
scheme: semver
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -22,6 +22,10 @@ inputs:
|
||||
Not applicable to `calver` scheme
|
||||
required: false
|
||||
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:
|
||||
current-version:
|
||||
@@ -75,3 +79,4 @@ runs:
|
||||
increment: ${{ inputs.increment }}
|
||||
pep440: ${{ inputs.pep440 }}
|
||||
scheme: ${{ inputs.scheme }}
|
||||
release_branch: ${{ inputs.release_branch }}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user