Skip to content

Commit 8910695

Browse files
critesjoshclaude
andcommitted
feat: add semantic-release and commitlint for automated versioning
- Replace manual version check with semantic-release for automatic version bumping, npm publishing, and GitHub releases - Add commitlint to enforce conventional commit messages on PRs - Commit messages now determine version bumps: fix: → patch, feat: → minor, feat!:/BREAKING CHANGE: → major Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0d034da commit 8910695

5 files changed

Lines changed: 7021 additions & 1097 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ on:
77
branches: [main]
88

99
jobs:
10+
commitlint:
11+
runs-on: ubuntu-latest
12+
if: github.event_name == 'pull_request'
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: 20
20+
- run: npm ci
21+
- name: Lint commits
22+
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
23+
1024
test:
1125
runs-on: ubuntu-latest
1226
steps:
@@ -18,30 +32,26 @@ jobs:
1832
- run: npm test
1933
- run: npm run build
2034

21-
publish:
35+
release:
2236
needs: test
2337
runs-on: ubuntu-latest
2438
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
39+
permissions:
40+
contents: write
41+
issues: write
42+
pull-requests: write
2543
steps:
2644
- uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 0
2747
- uses: actions/setup-node@v4
2848
with:
2949
node-version: 20
3050
registry-url: https://registry.npmjs.org
3151
- run: npm ci
3252
- run: npm run build
33-
- name: Check if version changed
34-
id: version
35-
run: |
36-
CURRENT=$(node -p "require('./package.json').version")
37-
PUBLISHED=$(npm view @aztec/mcp-server version 2>/dev/null || echo "0.0.0")
38-
if [ "$CURRENT" != "$PUBLISHED" ]; then
39-
echo "changed=true" >> $GITHUB_OUTPUT
40-
else
41-
echo "changed=false" >> $GITHUB_OUTPUT
42-
fi
43-
- name: Publish to npm
44-
if: steps.version.outputs.changed == 'true'
45-
run: npm publish
53+
- name: Release
54+
run: npx semantic-release
4655
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4757
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.releaserc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
"@semantic-release/npm",
7+
"@semantic-release/github"
8+
]
9+
}

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default { extends: ['@commitlint/config-conventional'] };

0 commit comments

Comments
 (0)