Skip to content

Commit 26b83b1

Browse files
committed
Add tag-suffix; Adjust documentation
1 parent d338e2b commit 26b83b1

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

.github/workflows/template_release_version.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
required: false
88
type: string
99
default: 'v'
10+
tag-suffix:
11+
required: false
12+
type: string
13+
default: ''
1014
format:
1115
required: false
1216
type: string
@@ -33,6 +37,7 @@ jobs:
3337
id: set_version
3438
run: |
3539
TAG_PREFIX=${{ inputs['tag-prefix'] }}
40+
TAG_SUFFIX=${{ inputs['tag-suffix'] }}
3641
DATE=$(date +"%Y%m%d")
3742
YEAR=$(date +"%Y")
3843
WEEK=$(date +"%-V")
@@ -48,8 +53,11 @@ jobs:
4853
COUNTER=0
4954
else
5055
# fetch last tag name from github releases which are not drafts or pre-releases and starts with the given prefix
51-
OLD_TAG_NAME=`gh release list -R ${{ github.repository }} --limit 100 --exclude-drafts --exclude-pre-releases --json tagName --jq '[.[] | select(.tagName | startswith("${TAG_PREFIX}"))] | .[0].tagName'`
52-
OLD_VERSION=${OLD_TAG_NAME#${TAG_PREFIX}}
56+
OLD_TAG_NAME=`gh release list -R ${{ github.repository }} --limit 100 --exclude-drafts --exclude-pre-releases --json tagName --jq '[.[] | select(.tagName | startswith("${TAG_PREFIX}") and endswith("${TAG_SUFFIX}"))] | .[0].tagName'`
57+
58+
# remove prefix and suffix
59+
OLD_VERSION=${${OLD_TAG_NAME#${TAG_PREFIX}}%${TAG_SUFFIX}}
60+
5361
PARTS=(${OLD_VERSION//./ })
5462
COUNTER=${PARTS[2]}
5563
MINOR_FROM_LAST_TAG=${PARTS[1]}
@@ -75,5 +83,5 @@ jobs:
7583
COUNTER=$((COUNTER+1))
7684
7785
echo "next_version=${YEAR}.${MINOR}.${COUNTER}" >> $GITHUB_OUTPUT
78-
echo "next_tag=${TAG_PREFIX}${YEAR}.${MINOR}.${COUNTER}" >> $GITHUB_OUTPUT
86+
echo "next_tag=${TAG_PREFIX}${YEAR}.${MINOR}.${COUNTER}${TAG_SUFFIX}" >> $GITHUB_OUTPUT
7987
shell: bash

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,10 @@ jobs:
430430
new_version:
431431
uses: Staffbase/gha-workflows/.github/workflows/template_release_version.yml@v9.0.0
432432
with:
433-
# optional: prefix of the tag in order to find the last release this is useful for multi artifact/service repositories, default: v
434-
tag-prefix: 'v'
433+
# optional: prefix of the tag in order to find the last release; this is useful for multi artifact/service repositories, default: 'v'
434+
tag-prefix: 'app-v'
435+
# optional: suffix of the tag in order to find the last release; this is useful for multi artifact/service repositories, default: '' (empty string)
436+
tag-suffix: '-native'
435437
# optional: format of the version, default: weekly
436438
format: 'quarterly'
437439
```

0 commit comments

Comments
 (0)