Skip to content

Commit 4af33a0

Browse files
Add auto-tag workflow
Runs when the version is bumped, creates and pushes a tag.
1 parent b5ab93f commit 4af33a0

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/auto-tag.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Auto Tag on Version Bump
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- VERSION
9+
10+
jobs:
11+
tag-repo:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
steps:
16+
- name: Check out repository
17+
uses: actions/checkout@v5
18+
19+
- name: Get current version
20+
id: version
21+
run: |
22+
VERSION=$(cat VERSION)
23+
echo "version=$VERSION" >> $GITHUB_OUTPUT
24+
25+
- name: Skip if tag already exists
26+
run: |
27+
if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
28+
echo "skip=true" >> $GITHUB_OUTPUT
29+
else
30+
echo "skip=false" >> $GITHUB_OUTPUT
31+
fi
32+
33+
- name: Push tag
34+
if: steps.checktag.outputs.skip == 'false'
35+
run: |
36+
git config user.name "github-actions[bot]"
37+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
38+
git tag "v${{ steps.version.outputs.version }}"
39+
git push origin "v${{ steps.version.outputs.version }}"

0 commit comments

Comments
 (0)