Enhance release workflow to include version tagging and GitHub releas… #14
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
| name: Version Bump & Release | |
| on: | |
| push: | |
| branches: [main] | |
| concurrency: | |
| group: release | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| bump: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| persist-credentials: true | |
| - name: Skip if this is a version-bump commit | |
| id: guard | |
| env: | |
| COMMIT_MSG: ${{ github.event.head_commit.message }} | |
| run: | | |
| if echo "$COMMIT_MSG" | grep -q "^chore: bump version"; then | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "skip=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Configure git | |
| if: steps.guard.outputs.skip == 'false' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Bump patch version | |
| if: steps.guard.outputs.skip == 'false' | |
| id: bump | |
| run: | | |
| CURRENT=$(jq -r '.version' package.json) | |
| IFS='.' read -ra PARTS <<< "$CURRENT" | |
| NEW="${PARTS[0]}.${PARTS[1]}.$((${PARTS[2]} + 1))" | |
| echo "new=$NEW" >> "$GITHUB_OUTPUT" | |
| jq --arg v "$NEW" '.version = $v' package.json > _tmp.json && mv _tmp.json package.json | |
| jq --arg v "$NEW" '.version = $v' manifests/academic-writer.json > _tmp.json && mv _tmp.json manifests/academic-writer.json | |
| jq --arg v "$NEW" '.version = $v | .plugins[0].version = $v' .claude-plugin/marketplace.json > _tmp.json && mv _tmp.json .claude-plugin/marketplace.json | |
| git add package.json manifests/academic-writer.json .claude-plugin/marketplace.json | |
| git commit -m "chore: bump version to v${NEW}" | |
| git tag "v${NEW}" | |
| git push origin main | |
| git push origin "v${NEW}" | |
| - name: Create GitHub Release | |
| if: steps.guard.outputs.skip == 'false' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: "v${{ steps.bump.outputs.new }}" | |
| name: "v${{ steps.bump.outputs.new }}" | |
| generate_release_notes: true |