File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Update Major Tag
2+
3+ on :
4+ release :
5+ types :
6+ - published
7+
8+ permissions :
9+ contents : write
10+
11+ jobs :
12+ move-major-tag :
13+ runs-on : ubuntu-latest
14+ if : startsWith(github.event.release.tag_name, 'v')
15+ steps :
16+ - name : Checkout
17+ uses : actions/checkout@v4
18+ with :
19+ fetch-depth : 0
20+
21+ - name : Configure Git
22+ run : |
23+ git config user.name "github-actions"
24+ git config user.email "[email protected] " 25+
26+ - name : Move major tag
27+ env :
28+ RELEASE_TAG : ${{ github.event.release.tag_name }}
29+ run : |
30+ if ! echo "$RELEASE_TAG" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
31+ echo "Release tag $RELEASE_TAG is not a v*.*.* semver tag. Skipping." >&2
32+ exit 0
33+ fi
34+ git fetch origin "refs/tags/$RELEASE_TAG:refs/tags/$RELEASE_TAG"
35+ COMMIT=$(git rev-list -n 1 "$RELEASE_TAG")
36+ MAJOR_TAG=$(echo "$RELEASE_TAG" | sed -E 's/^v([0-9]+)\..*/v\1/')
37+ git tag -fa "$MAJOR_TAG" "$COMMIT" -m "Align $MAJOR_TAG with $RELEASE_TAG"
38+ git push origin "$MAJOR_TAG" --force
You can’t perform that action at this time.
0 commit comments