44 workflow_dispatch :
55 inputs :
66 release_type :
7- description : " Select version bump type"
7+ description : ' Select version bump type'
88 required : true
9- default : " patch"
9+ default : ' patch'
1010 type : choice
1111 options :
1212 - patch
@@ -17,56 +17,55 @@ jobs:
1717 bump-version :
1818 runs-on : ubuntu-latest
1919 steps :
20- - name : Checkout repository
21- uses : actions/checkout@v4
20+ - name : Checkout code
21+ uses : actions/checkout@v5
2222 with :
23+ token : ${{ secrets.GITHUB_TOKEN }}
2324 fetch-depth : 0
2425
25- - name : Setup Node.js
26- uses : actions/setup-node@v4
27- with :
28- node-version : 20
29-
3026 - name : Setup pnpm
3127 uses : pnpm/action-setup@v4
3228 with :
3329 version : 10.13.1
34- run_install : true
30+ run_install : false
3531
36- - name : Configure Git
37- run : |
38- git config user.name "github-actions[bot]"
39- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
40-
41- - name : Bump version and commit to main
42- id : bump
43- run : |
44- RAW_VERSION=$(pnpm version ${{ inputs.release_type }} --no-git-tag-version | tail -n1)
45- CLEAN_VERSION=$(echo "$RAW_VERSION" | sed 's/^v//')
32+ - name : Set up Node
33+ uses : actions/setup-node@v4
34+ with :
35+ node-version : 22
4636
47- echo "raw_version=$RAW_VERSION" >> $GITHUB_ENV
48- echo "clean_version=$CLEAN_VERSION" >> $GITHUB_ENV
37+ - name : Install dependencies
38+ run : pnpm install --frozen-lockfile
4939
50- git add package.json pnpm-lock.yaml
51- if git diff --cached --quiet; then
52- echo "⚠️ No version bump changes detected. Skipping commit & PR."
53- exit 0
54- fi
40+ - name : Generate new version
41+ id : version
42+ run : |
43+ NEW_VERSION=$(pnpm version ${{ inputs.release_type }} --no-git-tag-version | awk '{print $NF}')
44+ echo "new_version=$NEW_VERSION" >> $GITHUB_ENV
5545
56- git commit -m "chore(release): bump version to $RAW_VERSION"
57- git push origin main
46+ - name : Create new branch
47+ run : |
48+ git checkout -b release/${{ env.new_version }}
5849
59- - name : Create release branch
50+ - name : Commit & Push changes
6051 run : |
61- git checkout -b release/v${{ env.clean_version }}
62- git push origin release/v${{ env.clean_version }}
52+ git config user.name "github-actions[bot]"
53+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
54+ git add package.json pnpm-lock.yaml
55+ git commit -m "chore(release): bump version to ${{ env.new_version }}"
56+ git push origin release/${{ env.new_version }}
6357
6458 - name : Create Pull Request
65- env :
66- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6759 run : |
6860 gh pr create \
6961 --base main \
70- --head release/v${{ env.clean_version }} \
71- --title "Release: v${{ env.raw_version }}" \
72- --body "Auto-generated release PR for version ${{ env.raw_version }}"
62+ --head release/${{ env.new_version }} \
63+ --title "Release: ${{ env.new_version }}" \
64+ --body "Auto-generated release PR for version ${{ env.new_version }}"
65+ env :
66+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
67+
68+ - name : Notify about Major Release (if major)
69+ if : inputs.release_type == 'major'
70+ run : |
71+ echo "🚨 Major version update detected! Please review and merge manually."
0 commit comments