Skip to content

Commit 4c6fcb7

Browse files
author
Ben Avrahami
committed
support prefix
1 parent 597a82a commit 4c6fcb7

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# is-new-version Changelog
2+
## 1.1.0
3+
* The action now accepts a prefix to be added to the release tag, the full tag is now returned as `release-tag`
24
## 1.0.3
35
* hopefully trully fixed incorrect marking of prerelease versions
46
## 1.0.2

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ jobs:
3333
## inputs
3434
* `toml-path`: the path to the TOML file to use to determine the version, default to `pyproject.toml`
3535
* `changelog-path`: the path to the markdown file to use to determine the version, default to `CHANGELOG.md`
36+
* `release-prefix`: the prefix to be added to the release tag, default to an empty string
3637

3738
## outputs
3839
* `is-new`: whether the step detected a new version
3940
* `found-version`: the version detected by the action
4041
* `release-notes`: the markdown snippet of the release notes of the version, will be blank if no version is not new
4142
* `is-prerelease`: whether the version is detected as a pre-release (currently, all versions with a `-` in them are considered pre-releases). Will be blank if no version is not new.
43+
* `release-tag`: the full tag of the release, including the prefix

action.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
22
name: 'Detect New Version'
33
author: 'Biocatch'
4-
description: 'Will check whther the current version is unreleased'
4+
description: 'Will check whether the current version is unreleased'
55
inputs:
66
toml-path:
77
description: 'The path to the toml file containing the version'
@@ -11,6 +11,10 @@ inputs:
1111
description: 'The path to the changelog file'
1212
required: false
1313
default: 'CHANGELOG.md'
14+
release-prefix:
15+
description: 'The prefix to the name of the release'
16+
required: false
17+
default: ''
1418
outputs:
1519
is-new:
1620
description: 'Whether the version was detected as new'
@@ -24,6 +28,9 @@ outputs:
2428
is-prerelease:
2529
description: 'whether or not the version was detected as pre-release'
2630
value: ${{ steps.detect-prerelease.outputs.is-prerelease }}
31+
release-tag:
32+
description: 'The tag of the release'
33+
value: ${{ steps.fetch-version.outputs.release-tag }}
2734
runs:
2835
using: "composite"
2936
steps:
@@ -39,18 +46,20 @@ runs:
3946
PUSHED_VERSION="$(cat ${{ inputs.toml-path }} | grep -E -m 1 '^version' | cut -d '"' -f 2)"
4047
echo "found-version=$PUSHED_VERSION" >> $GITHUB_OUTPUT
4148
echo "Detection version from \`${{ inputs.toml-path }}\`: \`$PUSHED_VERSION\`" >> $GITHUB_STEP_SUMMARY
49+
RELEASE_TAG="${{ inputs.release-prefix }}$PUSHED_VERSION"
50+
echo "release-tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
4251
4352
- name: check if tag exists
4453
id: check-if-tag-exists
4554
shell: bash
4655
env:
47-
PUSHED_VERSION: ${{ steps.fetch-version.outputs.found-version }}
56+
PENDING_VERSION: ${{ steps.fetch-version.outputs.release-tag }}
4857
run: |
49-
if [ $(git tag -l $PUSHED_VERSION) ]; then
50-
echo "Tag \"$PUSHED_VERSION\" already exists" >> $GITHUB_STEP_SUMMARY
58+
if [ $(git tag -l $PENDING_VERSION) ]; then
59+
echo "Tag \"$PENDING_VERSION\" already exists" >> $GITHUB_STEP_SUMMARY
5160
echo "is-new=false" >> $GITHUB_OUTPUT
5261
else
53-
echo "Tag \"$PUSHED_VERSION\" does not exist." >> $GITHUB_STEP_SUMMARY
62+
echo "Tag \"$PENDING_VERSION\" does not exist." >> $GITHUB_STEP_SUMMARY
5463
echo "Checked the following tags:"
5564
git tag -l >> $GITHUB_STEP_SUMMARY
5665
echo "is-new=true" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)