Skip to content

Commit f6722ba

Browse files
committed
ci: add automated semver release workflow
1 parent 82270cc commit f6722ba

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
issues: write
11+
pull-requests: write
12+
13+
jobs:
14+
release:
15+
name: Semantic Release
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
persist-credentials: false
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 'lts/*'
28+
29+
- name: Install semantic-release
30+
run: |
31+
npm install --no-save \
32+
semantic-release \
33+
@semantic-release/changelog \
34+
@semantic-release/git \
35+
@semantic-release/github \
36+
conventional-changelog-conventionalcommits
37+
38+
- name: Release
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
run: npx semantic-release

.releaserc.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
[
5+
"@semantic-release/commit-analyzer",
6+
{
7+
"preset": "conventionalcommits",
8+
"releaseRules": [
9+
{ "breaking": true, "release": "major" },
10+
{ "type": "feat", "release": "minor" },
11+
{ "type": "fix", "release": "patch" },
12+
{ "type": "perf", "release": "patch" },
13+
{ "type": "refactor", "release": "patch" }
14+
]
15+
}
16+
],
17+
[
18+
"@semantic-release/release-notes-generator",
19+
{ "preset": "conventionalcommits" }
20+
],
21+
[
22+
"@semantic-release/changelog",
23+
{ "changelogFile": "CHANGELOG.md" }
24+
],
25+
[
26+
"@semantic-release/github",
27+
{ "successComment": false }
28+
],
29+
[
30+
"@semantic-release/git",
31+
{
32+
"assets": ["CHANGELOG.md"],
33+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
34+
}
35+
]
36+
]
37+
}

0 commit comments

Comments
 (0)