Skip to content

Commit 7e32477

Browse files
authored
feat: automatically update major tags (#3)
1 parent edd03c5 commit 7e32477

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/versions.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Automatically update major tags
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
update-major-tag:
10+
name: Update major tag
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v5
15+
16+
- name: Configure git
17+
run: |
18+
git config user.name github-actions
19+
git config user.email github-actions@github.com
20+
21+
- name: Update tags
22+
run: |
23+
set -eu
24+
25+
NEW_TAG="${GITHUB_REF#refs/tags/}"
26+
[ -z "$NEW_TAG" ] && exit 10
27+
28+
MAJOR=$(expr "$NEW_TAG" : '\(v[0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*$')
29+
[ -z "$MAJOR" ] && exit 20
30+
31+
git fetch --tags
32+
git tag -f "$MAJOR" "$NEW_TAG"
33+
git push origin "$MAJOR" --force

0 commit comments

Comments
 (0)