From f67fc280b0b2ab95608ba611da337a94287d1ec0 Mon Sep 17 00:00:00 2001 From: Neil Carvalho Date: Fri, 28 Aug 2026 15:03:31 -0300 Subject: [PATCH] Move the major version tag automatically The README tells consumers to pin `thoughtbot/importmap-update@v1`, but the `v1` tag was never pushed during the 1.0.0 release because moving it is a manual step in RELEASING.md that is easy to forget. Every release carries the same risk of leaving the documented usage broken. This adds a workflow that derives the major version from the published release tag and force-pushes it, so the floating tag tracks the latest patch without anyone having to remember. The workflow skips prereleases and any tag that is not in vMAJOR.MINOR.PATCH form, so the alpha series cannot move `v1`. It creates a lightweight tag with no release attached, which is what keeps the tag movable now that immutable releases are enabled here. One case is deliberately unguarded: publishing an older patch after a newer one in the same series would move the major tag backwards. Guarding it needs version comparison logic that a single active release line does not justify. --- .github/workflows/major-version-tag.yml | 30 +++++++++++++++++++++++++ RELEASING.md | 7 ++---- 2 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/major-version-tag.yml diff --git a/.github/workflows/major-version-tag.yml b/.github/workflows/major-version-tag.yml new file mode 100644 index 0000000..cd5113c --- /dev/null +++ b/.github/workflows/major-version-tag.yml @@ -0,0 +1,30 @@ +name: Major version tag + +on: + release: + types: [published] + +permissions: + contents: write + +jobs: + retag: + if: "!github.event.release.prerelease" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + + - name: Move major version tag + env: + TAG: ${{ github.event.release.tag_name }} + run: | + if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Skipping: $TAG is not a vMAJOR.MINOR.PATCH tag" + exit 0 + fi + + major="${TAG%%.*}" + git tag -f "$major" "$TAG" + git push --force origin "$major" diff --git a/RELEASING.md b/RELEASING.md index c9740c3..d8b096a 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -11,12 +11,9 @@ This action follows [Semantic Versioning]. The major version tag (e.g. `v1`) is kept pointing at the latest patch release in that series so consumers who pin `thoughtbot/importmap-update@v1` get updates automatically. -After tagging `v1.x.x`, move the floating tag: +The [Major version tag workflow](.github/workflows/major-version-tag.yml) moves it automatically when a non-prerelease release is published, so step 5 above is the last manual step. -``` -git tag -f v1 -git push --force origin v1 -``` +Do not create a GitHub release for the `v1` tag. Releases in this repo are immutable, and attaching one would freeze the tag in place. [Semantic Versioning]: https://semver.org