Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/update-major-version-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Update Major Version Tag

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
inputs:
tag:
description: 'The full version tag to process (e.g., v13.1.0)'
required: true
type: string

jobs:
update-major-tag:
name: Update Major Version Tag
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get tag name
id: get-tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG="${{ inputs.tag }}"
else
TAG="${GITHUB_REF#refs/tags/}"
fi
echo "tag=$TAG" >> $GITHUB_OUTPUT
# Extract major version (e.g., v13 from v13.1.0)
MAJOR_TAG=$(echo "$TAG" | sed -E 's/^(v[0-9]+)\..*/\1/')
echo "major_tag=$MAJOR_TAG" >> $GITHUB_OUTPUT

- name: Update major version tag
run: |
TAG="${{ steps.get-tag.outputs.tag }}"
MAJOR_TAG="${{ steps.get-tag.outputs.major_tag }}"

echo "Processing tag: $TAG"
echo "Major version tag: $MAJOR_TAG"

# Configure git
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

# Get the commit SHA for the pushed tag
COMMIT_SHA=$(git rev-list -n 1 "$TAG")
echo "Commit SHA: $COMMIT_SHA"

# Delete the major tag locally if it exists
git tag -d "$MAJOR_TAG" 2>/dev/null || true

# Create/update the major version tag pointing to the same commit
git tag "$MAJOR_TAG" "$COMMIT_SHA"

# Force push the major version tag to origin
git push origin "$MAJOR_TAG" --force

echo "Successfully updated $MAJOR_TAG to point to $TAG ($COMMIT_SHA)"
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ jobs:

For more application cases please check [Smoke Test Workflow file](https://github.com/DeLaGuardo/setup-clojure/blob/main/.github/workflows/smoke-tests.yml)

# Versioning

You can reference this action using either:

- **Full version** (e.g., `DeLaGuardo/[email protected]`) - pins to a specific release
- **Major version** (e.g., `DeLaGuardo/setup-clojure@v13`) - automatically receives all minor and patch updates within that major version

Using the major version tag is recommended for most users, as it ensures you receive bug fixes and new features without breaking changes.

# License

The scripts and documentation in this project are released under the [MIT License](LICENSE)
Loading