-
Notifications
You must be signed in to change notification settings - Fork 4
AX-1734: Add tag/release mechanism #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+110
−0
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
abe0571
[minor] Add tag/release mechanism and drift-prevention check (AX-1734)
YoniMelki 3eda24c
Aligning VERSION
YoniMelki 3849aeb
AX-1734 - Apply PR review feedback: copyright headers, checkout@v5, s…
YoniMelki 9343086
Merge remote-tracking branch 'origin/main' into ax-1734-release-mecha…
YoniMelki f7578cb
AX-1734 - Use plugin.json as the single version source; drop the VERS…
YoniMelki 119a8ba
AX-1734 - Trigger releases from the commit subject only
YoniMelki 005c19f
AX-1734 - Gate the release on validation, and create the tag with the…
1478112
AX-1734 - Move the release rationale out of the workflow and into CON…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| # Copyright (c) JFrog Ltd. 2026 | ||
| # | ||
| # Cuts a GitHub Release when a release marker is merged to main. | ||
| # Full flow and rationale: CONTRIBUTING.md#releasing | ||
| name: Release | ||
|
yanivt-jfrog marked this conversation as resolved.
yanivt-jfrog marked this conversation as resolved.
|
||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| # Full history, so the tag check below can see existing tags. | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| # Subject line only, not the whole message. MSG goes through env rather than string | ||
| # interpolation, so a crafted commit subject can't inject shell. | ||
| - name: Detect release marker in commit subject | ||
| id: detect | ||
| env: | ||
| MSG: ${{ github.event.head_commit.message }} | ||
| run: | | ||
| SUBJECT=$(printf '%s\n' "$MSG" | head -1) | ||
| if printf '%s' "$SUBJECT" | grep -qE '\[(major|minor|patch)\]'; then | ||
| echo "triggered=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "triggered=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| # The manifest is the only place the version lives. | ||
| - name: Read version from the plugin manifest | ||
| if: steps.detect.outputs.triggered == 'true' | ||
| id: version | ||
| run: | | ||
| set -euo pipefail | ||
| VERSION=$(jq -er '.version' .claude-plugin/plugin.json) | ||
| if ! printf '%s' "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then | ||
| echo "::error::.claude-plugin/plugin.json version '$VERSION' is not X.Y.Z — refusing to release" | ||
| exit 1 | ||
| fi | ||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
|
|
||
| # A tag exists only if that version was released, so this catches a marker that was merged | ||
| # without a manifest bump. | ||
| - name: Refuse to re-release an existing version | ||
| if: steps.detect.outputs.triggered == 'true' | ||
| run: | | ||
| TAG="v${{ steps.version.outputs.version }}" | ||
| if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then | ||
| echo "::error::$TAG already exists — bump .claude-plugin/plugin.json before merging a release marker" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - uses: actions/setup-node@v5 | ||
| if: steps.detect.outputs.triggered == 'true' | ||
| with: | ||
| node-version: "24" | ||
|
|
||
| # validate.yml runs on this same push, but as an independent workflow that can't gate this | ||
| # one. Re-running its check here is what actually gates the release on it. | ||
| - name: Validate plugin layout before releasing | ||
| if: steps.detect.outputs.triggered == 'true' | ||
| run: node scripts/validate-claude-plugin.mjs | ||
|
|
||
| # Tracked files at HEAD only, so nothing left on the runner can end up in the zip. | ||
| - name: Package release artifact | ||
| if: steps.detect.outputs.triggered == 'true' | ||
| run: git archive --format=zip --output=release.zip HEAD -- ':(exclude).github' | ||
|
|
||
| # --target creates the tag as part of the release, so a failure can't leave an orphan tag. | ||
| - name: Create GitHub Release | ||
| if: steps.detect.outputs.triggered == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| gh release create "v${{ steps.version.outputs.version }}" \ | ||
| release.zip \ | ||
| --target "$GITHUB_SHA" \ | ||
| --title "Release v${{ steps.version.outputs.version }}" \ | ||
| --generate-notes | ||
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.