0.6.0 — dry-run on the composite action #3
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: tag-major | |
| # Maintains the floating `v0` major tag so users can pin `uses: | |
| # modern-python/semvertag@v0` and ride minor bumps. Skipped on | |
| # prereleases so a `0.5.0-rc1` does not drag `v0` ahead of the latest | |
| # stable. When 1.0.0 ships, this same job creates `v1` automatically | |
| # from the tag name's leading segment. | |
| # | |
| # This project's release tags are bare semver (e.g. `0.4.0`, no `v`), | |
| # but the floating action tag is `v`-prefixed (`v0`) to match the GHA | |
| # convention for `uses: org/repo@vN`. The shell below strips any | |
| # leading `v` from RELEASE_TAG and unconditionally prepends one to the | |
| # major segment so the workflow works for both bare and v-prefixed | |
| # release tag styles. | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-major-tag: | |
| if: ${{ !github.event.release.prerelease }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Update major tag | |
| env: | |
| RELEASE_TAG: ${{ github.event.release.tag_name }} | |
| run: | | |
| set -euo pipefail | |
| # RELEASE_TAG = '0.4.0' (this project) or 'v0.4.0' (defensive) → major = 'v0' | |
| raw="${RELEASE_TAG#v}" | |
| major="v${raw%%.*}" | |
| git config user.name 'github-actions[bot]' | |
| git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
| git tag -fa "$major" "$RELEASE_TAG" -m "Update $major to $RELEASE_TAG" | |
| git push -f origin "$major" |