v0.0.1 #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| tag-major: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Move major version tag | |
| if: ${{ !github.event.release.prerelease }} | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| VERSION="${{ github.event.release.tag_name }}" | |
| # Only move the major tag if this is the latest release for the repo | |
| LATEST=$(gh release view --repo "${{ github.repository }}" --json tagName -q .tagName) | |
| if [ "$LATEST" != "$VERSION" ]; then | |
| echo "Skipping: $VERSION is not the latest release (latest is $LATEST)" | |
| exit 0 | |
| fi | |
| MAJOR="v$(echo "$VERSION" | sed 's/^v//' | cut -d. -f1)" | |
| git tag -f "$MAJOR" | |
| git push origin "refs/tags/$MAJOR" --force |