Skip to content
Open
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
96 changes: 96 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Tag Release

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: write # Needed for tags & releases

concurrency:
group: tag-release-${{ github.ref }}
cancel-in-progress: false

jobs:
tag-release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.GITHUB_TOKEN }}

- name: Sync & prune tags
run: |
git fetch --tags --force --prune

- name: Determine version from composer.json
id: version
run: |
VERSION=$(jq -r '.version // empty' composer.json)
if [ -z "$VERSION" ]; then
echo "composer.json does not have a 'version' field"; exit 1
fi

# prefix with 'v' if it's not already
if [[ "$VERSION" =~ ^v ]]; then
TAG="$VERSION"
else
TAG="v$VERSION"
fi

echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "Resolved tag: $TAG"

- name: Check if tag exists on origin
id: check_tag
run: |
TAG="${{ steps.version.outputs.tag }}"
if git ls-remote --tags origin | grep -q "refs/tags/${TAG}$"; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "Tag ${TAG} already exists on origin"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
echo "Tag ${TAG} does not exist on origin"
fi

- name: Create and push tag
if: steps.check_tag.outputs.exists == 'false'
run: |
TAG="${{ steps.version.outputs.tag }}"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git tag -a "${TAG}" -m "Version ${TAG}"
git push origin "refs/tags/${TAG}"

- name: Check if release exists
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
HTTP_STATUS=$(curl -sS -o /dev/null -w '%{http_code}' \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ steps.version.outputs.tag }}")
if [ "$HTTP_STATUS" = "200" ]; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi

- name: Create GitHub Release (autogenerated notes)
if: steps.release.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: Version ${{ steps.version.outputs.tag }}
generate_release_notes: true
allow_updates: true
env:
Comment on lines +87 to +95
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Remove unsupported allow_updates input

softprops/action-gh-release@v2 does not define an allow_updates input, so this step will fail at runtime with “Unexpected input 'allow_updates'” and the release will never be created.(github.com) Remove that key (the action already updates existing releases automatically) to keep the workflow green.

       generate_release_notes: true
-      allow_updates: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Create GitHub Release (autogenerated notes)
if: steps.release.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: Version ${{ steps.version.outputs.tag }}
generate_release_notes: true
allow_updates: true
env:
- name: Create GitHub Release (autogenerated notes)
if: steps.release.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: Version ${{ steps.version.outputs.tag }}
generate_release_notes: true
env:
🧰 Tools
🪛 actionlint (1.7.7)

94-94: input "allow_updates" is not defined in action "softprops/action-gh-release@v2". available inputs are "append_body", "body", "body_path", "discussion_category_name", "draft", "fail_on_unmatched_files", "files", "generate_release_notes", "make_latest", "name", "prerelease", "preserve_order", "repository", "tag_name", "target_commitish", "token"

(action)

🤖 Prompt for AI Agents
In .github/workflows/release.yml around lines 87 to 95, remove the unsupported
allow_updates input from the softprops/action-gh-release@v2 step — delete the
allow_updates: true line so the action uses its built-in release update
behavior; keep the other inputs (tag_name, name, generate_release_notes)
unchanged and commit the change to prevent the “Unexpected input
'allow_updates'” runtime error.

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}