Skip to content

Commit 81d4ee4

Browse files
committed
ci: setup semantic release with automatic changelog
Configure semantic-release for automated versioning and changelog generation based on conventional commits. Add GitHub Actions CI workflow that runs tests on PRs and triggers releases on main.
1 parent 2356b1f commit 81d4ee4

4 files changed

Lines changed: 6455 additions & 360 deletions

File tree

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 22
17+
cache: npm
18+
- run: npm ci
19+
- run: npm test
20+
21+
release:
22+
needs: test
23+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: write
27+
issues: write
28+
pull-requests: write
29+
id-token: write
30+
steps:
31+
- uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0
34+
- uses: actions/setup-node@v4
35+
with:
36+
node-version: 22
37+
cache: npm
38+
- run: npm ci
39+
- run: npm test
40+
- run: npx semantic-release
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.releaserc.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
["@semantic-release/changelog", {
7+
"changelogFile": "CHANGELOG.md"
8+
}],
9+
"@semantic-release/npm",
10+
["@semantic-release/git", {
11+
"assets": ["CHANGELOG.md", "package.json", "package-lock.json"],
12+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
13+
}],
14+
"@semantic-release/github"
15+
]
16+
}

0 commit comments

Comments
 (0)