1616jobs :
1717 bump-version :
1818 runs-on : ubuntu-latest
19- permissions :
20- contents : write
21- pull-requests : write
2219 steps :
2320 - name : Checkout code
2421 uses : actions/checkout@v5
@@ -40,42 +37,23 @@ jobs:
4037 - name : Install dependencies
4138 run : pnpm install --frozen-lockfile
4239
43- # Create release branch first
44- - name : Create release branch
45- run : |
46- NEW_VERSION=$(node -p "require('./package.json').version")
47- echo "current_version=$NEW_VERSION" >> $GITHUB_ENV
48- echo "Checking out release branch..."
49- git checkout -b release/temp || true
50-
51- # Bump version & commit on the new branch
52- - name : Bump version and commit
40+ - name : Generate new version
41+ id : version
5342 run : |
5443 NEW_VERSION=$(pnpm version ${{ inputs.release_type }} --no-git-tag-version | awk '{print $NF}')
5544 echo "new_version=$NEW_VERSION" >> $GITHUB_ENV
56- echo "New version: $NEW_VERSION"
5745
46+ - name : Create new branch
47+ run : |
48+ git checkout -b release/${{ env.new_version }}
49+
50+ - name : Commit & Push changes
51+ run : |
5852 git config user.name "github-actions[bot]"
5953 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
60-
6154 git add package.json pnpm-lock.yaml
62- if git diff --cached --quiet; then
63- echo "⚠️ No version bump changes detected. Skipping commit & PR."
64- exit 0
65- fi
66-
67- git commit -m "chore(release): bump version to $NEW_VERSION"
68-
69- # Rename branch with actual version number
70- git branch -m release/$NEW_VERSION
71- git push origin release/$NEW_VERSION
72-
73- - name : Check if branch has differences
74- run : |
75- if git diff origin/main..origin/release/${{ env.new_version }} --quiet; then
76- echo "⚠️ No changes detected between main and release/${{ env.new_version }}. Skipping PR."
77- exit 0
78- fi
55+ git commit -m "chore(release): bump version to ${{ env.new_version }}"
56+ git push origin release/${{ env.new_version }}
7957
8058 - name : Create Pull Request
8159 run : |
8563 --title "Release: ${{ env.new_version }}" \
8664 --body "Auto-generated release PR for version ${{ env.new_version }}"
8765 env :
88- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
66+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
8967
9068 - name : Notify about Major Release (if major)
9169 if : inputs.release_type == 'major'
92- run : echo "🚨 Major version update detected! Please review carefully."
70+ run : |
71+ echo "🚨 Major version update detected! Please review and merge manually."
0 commit comments