-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (56 loc) · 2.14 KB
/
release.yml
File metadata and controls
67 lines (56 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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