Skip to content

Commit 79426d5

Browse files
committed
chore: set release tag by commit count
1 parent 97ad3e7 commit 79426d5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,10 @@ jobs:
296296
pattern: sd-*
297297
merge-multiple: true
298298

299+
- name: Get commit count
300+
id: commit_count
301+
run: echo "count=$(git rev-list --count HEAD)" >> $GITHUB_OUTPUT
302+
299303
- name: Get commit hash
300304
id: commit
301305
uses: pr-mpt/actions-commit-hash@v2
@@ -306,7 +310,10 @@ jobs:
306310
env:
307311
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
308312
with:
309-
tag_name: ${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}
313+
tag_name: >
314+
${{ github.ref_name == 'master' &&
315+
format('release_{0}_{1}', steps.commit_count.outputs.count, steps.commit.outputs.short) ||
316+
format('{0}-{1}', env.BRANCH_NAME, steps.commit.outputs.short) }}
310317
311318
- name: Upload release
312319
id: upload_release

0 commit comments

Comments
 (0)