Skip to content

Commit fc3f64c

Browse files
authored
Add files via upload
1 parent 0dd976c commit fc3f64c

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/auto-tag.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 🔖 Auto Tag on Version Change
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "package.json"
8+
9+
jobs:
10+
tag:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
token: ${{ secrets.GITHUB_TOKEN }}
17+
18+
- name: Read version
19+
id: version
20+
run: |
21+
VERSION=$(node -p "require('./package.json').version")
22+
echo "version=$VERSION" >> $GITHUB_OUTPUT
23+
24+
- name: Check if tag exists
25+
run: |
26+
if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
27+
echo "Tag already exists, skipping."
28+
exit 0
29+
fi
30+
31+
- name: Create tag
32+
run: |
33+
git tag "v${{ steps.version.outputs.version }}"
34+
git push origin "v${{ steps.version.outputs.version }}"

0 commit comments

Comments
 (0)