Merge pull request #15 from reecetech/pre-release

Expose the pre-release label as an output
This commit is contained in:
Philip Jay
2022-05-16 11:08:08 +10:00
committed by GitHub
3 changed files with 8 additions and 2 deletions

View File

@@ -9,7 +9,7 @@
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Get next version - name: Get next version
uses: reecetech/version-increment@2022.2.4 uses: reecetech/version-increment@2022.5.1
id: version id: version
with: with:
scheme: semver scheme: semver
@@ -91,6 +91,7 @@ Examples:
| major-version | Major number of the incremented version | | major-version | Major number of the incremented version |
| minor-version | Minor number of the incremented version | | minor-version | Minor number of the incremented version |
| patch-version | Patch number of the incremented version | | patch-version | Patch number of the incremented version |
| pre-release-label | Pre-release label of the incremented version |
| major-v-version | Major number of the incremented version, prefixed with a `v` character | | major-v-version | Major number of the incremented version, prefixed with a `v` character |
| minor-v-version | Minor number of the incremented version, prefixed with a `v` character | | minor-v-version | Minor number of the incremented version, prefixed with a `v` character |
| patch-v-version | Patch number of the incremented version, prefixed with a `v` character | | patch-v-version | Patch number of the incremented version, prefixed with a `v` character |

View File

@@ -41,6 +41,9 @@ outputs:
patch-version: patch-version:
description: 'Patch number of the incremented version' description: 'Patch number of the incremented version'
value: ${{ steps.version-increment.outputs.patch-version }} value: ${{ steps.version-increment.outputs.patch-version }}
pre-release-version:
description: 'Pre-release label of the incremented version'
value: ${{ steps.version-increment.outputs.pre-release-label }}
major-v-version: major-v-version:
description: 'Major number of the incremented version, prefixed with a `v` charatcter' description: 'Major number of the incremented version, prefixed with a `v` charatcter'
value: ${{ steps.version-increment.outputs.major-v-version }} value: ${{ steps.version-increment.outputs.major-v-version }}

View File

@@ -74,7 +74,9 @@ fi
# add pre-release info to version if not the default branch # add pre-release info to version if not the default branch
if [[ "${current_ref}" != "refs/heads/${default_branch}" ]] ; then if [[ "${current_ref}" != "refs/heads/${default_branch}" ]] ; then
new_version="${new_version}-pre.${git_commit}" pre_release="pre.${git_commit}"
new_version="${new_version}-${pre_release}"
echo "::set-output name=pre-release-label::${pre_release}"
fi fi
if [[ -z "$(echo "${new_version}" | ${grep} -P "${pcre_semver}")" ]] ; then if [[ -z "$(echo "${new_version}" | ${grep} -P "${pcre_semver}")" ]] ; then