File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ release :
5+ types : [published]
6+
7+ jobs :
8+ tag-major :
9+ runs-on : ubuntu-latest
10+ permissions :
11+ contents : write
12+ steps :
13+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
14+
15+ - name : Move major version tag
16+ if : ${{ !github.event.release.prerelease }}
17+ env :
18+ GH_TOKEN : ${{ github.token }}
19+ run : |
20+ VERSION="${{ github.event.release.tag_name }}"
21+
22+ # Only move the major tag if this is the latest release for the repo
23+ LATEST=$(gh release view --repo "${{ github.repository }}" --json tagName -q .tagName)
24+ if [ "$LATEST" != "$VERSION" ]; then
25+ echo "Skipping: $VERSION is not the latest release (latest is $LATEST)"
26+ exit 0
27+ fi
28+
29+ MAJOR="v$(echo "$VERSION" | sed 's/^v//' | cut -d. -f1)"
30+ git tag -f "$MAJOR"
31+ git push origin "refs/tags/$MAJOR" --force
You can’t perform that action at this time.
0 commit comments