File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 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
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")
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]}
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
Original file line number Diff line number Diff 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` ` `
You can’t perform that action at this time.
0 commit comments