Skip to content

Merge pull request #68 from heznpc/fix/ci-lint-permissions #5

Merge pull request #68 from heznpc/fix/ci-lint-permissions

Merge pull request #68 from heznpc/fix/ci-lint-permissions #5

Workflow file for this run

name: Release — Tag & GitHub Release
on:
push:
branches: [main]
paths: [manifest.json]
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect version change
id: version
run: |
NEW=$(jq -r .version manifest.json)
OLD=$(git show HEAD~1:manifest.json 2>/dev/null | jq -r .version 2>/dev/null || echo "")
echo "new=$NEW" >> "$GITHUB_OUTPUT"
echo "old=$OLD" >> "$GITHUB_OUTPUT"
if [ "$NEW" != "$OLD" ] && [ -n "$NEW" ]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
echo "Version changed: $OLD → $NEW"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "Version unchanged ($NEW), skipping."
fi
- name: Create tag and GitHub release
if: steps.version.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="v${{ steps.version.outputs.new }}"
gh release create "$TAG" \
--target "$GITHUB_SHA" \
--title "$TAG" \
--generate-notes \
--notes-start-tag "v${{ steps.version.outputs.old }}" \
|| echo "Release $TAG already exists, skipping."