From 8a01c80ec212b9b161abd009e50f6970b807f2c9 Mon Sep 17 00:00:00 2001 From: David Larsen Date: Mon, 9 Mar 2026 14:44:31 -0400 Subject: [PATCH] Add workflow to maintain floating major version tag Adds a GitHub Actions workflow that automatically updates a floating major version tag (e.g., v1) whenever a new release is published. This lets consumers reference SocketDev/socket-basics@v1 to always get the latest release without pinning to a specific version. --- .../workflows/update-major-version-tag.yml | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/update-major-version-tag.yml diff --git a/.github/workflows/update-major-version-tag.yml b/.github/workflows/update-major-version-tag.yml new file mode 100644 index 0000000..0dc1a6a --- /dev/null +++ b/.github/workflows/update-major-version-tag.yml @@ -0,0 +1,34 @@ +name: Update Major Version Tag + +on: + release: + types: [published] + +permissions: + contents: write + +jobs: + update-tag: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Update floating major version tag + run: | + VERSION="${GITHUB_REF_NAME}" + + # Extract major version (e.g., "1" from "1.1.3") + MAJOR="v${VERSION%%.*}" + + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + # Delete existing major version tag if it exists + git tag -d "$MAJOR" 2>/dev/null || true + git push origin ":refs/tags/$MAJOR" 2>/dev/null || true + + # Create new tag pointing to the release commit + git tag "$MAJOR" + git push origin "$MAJOR" + + echo "Updated $MAJOR tag to point to $VERSION"