1- name : Auto Tag Release
1+ name : Release Workflow
22
33on :
44 push :
55 branches : [main]
66 paths :
77 - ' package.json'
8+ workflow_dispatch :
9+ inputs :
10+ version_type :
11+ description : ' Version bump type'
12+ required : true
13+ type : choice
14+ options :
15+ - patch
16+ - minor
17+ - major
18+ default : patch
819
920jobs :
10- auto-tag :
21+ release :
1122 runs-on : ubuntu-latest
23+ # Skip if commit is from github-actions bot or contains [skip ci]
24+ if : " !contains(github.event.head_commit.message, '[skip ci]') && github.actor != 'github-actions[bot]'"
1225
1326 permissions :
1427 contents : write
2033 fetch-depth : 0
2134 token : ${{ secrets.GA_TOKEN }}
2235
36+ - name : Setup Node.js
37+ uses : actions/setup-node@v4
38+ with :
39+ node-version : ' 18'
40+
41+ - name : Setup pnpm
42+ uses : pnpm/action-setup@v2
43+ with :
44+ version : latest
45+
46+ - name : Install dependencies
47+ run : pnpm install
48+
2349 - name : Get current version
2450 id : current-version
2551 run : |
3965 echo "Tag v$VERSION does not exist"
4066 fi
4167
68+ - name : Generate changelog
69+ if : steps.check-tag.outputs.exists == 'false'
70+ run : |
71+ npm run changelog
72+
4273 - name : Create and push tag
4374 if : steps.check-tag.outputs.exists == 'false'
4475 run : |
4778 git config --global user.name 'github-actions[bot]'
4879 git config --global user.email 'github-actions[bot]@users.noreply.github.com'
4980
81+ # Add changelog if it was updated
82+ git add CHANGELOG.md
83+
84+ # Check if there are changes to commit
85+ if ! git diff --staged --quiet; then
86+ git commit -m "docs: auto-update changelog for v$VERSION [skip ci]"
87+ git push origin main
88+ fi
89+
5090 # Create annotated tag
5191 git tag -a "v$VERSION" -m "Release v$VERSION"
5292 git push origin "v$VERSION"
@@ -65,8 +105,13 @@ jobs:
65105 🚀 **Release v${{ steps.current-version.outputs.version }}**
66106
67107 ## What's Changed
68- Check the [CHANGELOG.md](https://github.com/chess-labs/chessboard /blob/main/CHANGELOG.md) for detailed changes.
108+ Check the [CHANGELOG.md](https://github.com/chess-labs/core /blob/main/CHANGELOG.md) for detailed changes.
69109
70- **Full Changelog**: https://github.com/chess-labs/chessboard /compare/v${{ steps.current-version.outputs.version }}...HEAD
110+ **Full Changelog**: https://github.com/chess-labs/core /compare/v${{ steps.current-version.outputs.version }}...HEAD
71111 draft : false
72112 prerelease : false
113+
114+ - name : Skip message
115+ if : steps.check-tag.outputs.exists == 'true'
116+ run : |
117+ echo "⏭️ Tag v${{ steps.current-version.outputs.version }} already exists, skipping release"
0 commit comments