Skip to content

Commit 61b0249

Browse files
committed
chore: add semantic-release flow
Signed-off-by: msclock <[email protected]>
1 parent c4177fa commit 61b0249

File tree

2 files changed

+119
-0
lines changed

2 files changed

+119
-0
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,51 @@ jobs:
123123
push_options: --force
124124
commit_options: --amend --no-edit
125125
skip_fetch: true
126+
127+
release:
128+
name: release
129+
runs-on: ubuntu-latest
130+
permissions:
131+
contents: write # write for semantic-release
132+
needs: [pre-commit]
133+
134+
steps:
135+
- name: Checkout
136+
uses: actions/checkout@v4
137+
with:
138+
ref: ${{ github.head_ref }}
139+
token: ${{ secrets.GITHUB_TOKEN }}
140+
141+
- uses: actions/setup-node@v3
142+
with:
143+
node-version: 20
144+
145+
- name: Semantic Release
146+
uses: cycjimmy/semantic-release-action@v4
147+
id: semantic
148+
with:
149+
semantic_version: 22.0.5
150+
branches: |
151+
[
152+
'+([0-9])?(.{+([0-9]),x}).x',
153+
'master',
154+
'main',
155+
'next',
156+
'next-major',
157+
{
158+
name: 'beta',
159+
prerelease: true
160+
},
161+
{
162+
name: 'alpha',
163+
prerelease: true
164+
}
165+
]
166+
extra_plugins: |
167+
@semantic-release/changelog
168+
@semantic-release/git
169+
@semantic-release/exec
170+
@semantic-release/github
171+
conventional-changelog-conventionalcommits
172+
env:
173+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.releaserc.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
module.exports = {
2+
dryRun: false,
3+
plugins: [
4+
[
5+
"@semantic-release/commit-analyzer",
6+
{
7+
preset: "angular",
8+
releaseRules: [
9+
{ breaking: true, release: "major" },
10+
{ type: "feat", release: "minor" },
11+
{ type: "fix", release: "patch" },
12+
{ type: "style", release: "patch" },
13+
{ type: "refactor", release: "patch" },
14+
{ type: "perf", release: "patch" },
15+
{ type: "revert", release: "patch" },
16+
{ type: "chore", scope: "port*", release: "patch" },
17+
{ type: "build", release: false },
18+
{ type: "ci", release: false },
19+
{ type: "docs", release: false },
20+
{ type: "test", release: false },
21+
],
22+
parseOpts: {
23+
noteKeywords: ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
24+
},
25+
},
26+
],
27+
[
28+
"@semantic-release/release-notes-generator",
29+
{
30+
preset: "conventionalcommits",
31+
presetConfig: {
32+
types: [
33+
{ type: "feat", section: "Features" },
34+
{ type: "fix", section: "Bug Fixes" },
35+
{ type: "style", section: "Style" },
36+
{ type: "refactor", section: "Refactor" },
37+
{ type: "perf", section: "Performance" },
38+
{ type: "revert", section: "Reverts" },
39+
{ type: "chore", scope: "port*", section: "Ports" },
40+
{ type: "chore", section: "Chores" },
41+
{ type: "build", section: "Build" },
42+
{ type: "ci", section: "CI" },
43+
{ type: "docs", section: "Docs" },
44+
{ type: "test", section: "Tests" },
45+
],
46+
},
47+
parserOpts: {
48+
noteKeywords: ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
49+
},
50+
},
51+
],
52+
[
53+
"@semantic-release/exec",
54+
{
55+
publishCmd: [
56+
"git tag -a -f v${nextRelease.version} --cleanup=whitespace -m '${nextRelease.notes}'",
57+
"git push --force origin v${nextRelease.version}"
58+
].join(" && "),
59+
}
60+
],
61+
["@semantic-release/changelog", { changelogFile: "CHANGELOG.md" }],
62+
[
63+
"@semantic-release/git",
64+
{
65+
assets: ["CHANGELOG.md"],
66+
message: "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
67+
},
68+
],
69+
"@semantic-release/github",
70+
],
71+
};

0 commit comments

Comments
 (0)