Skip to content

Commit ae98059

Browse files
authored
feat: add semantic-release automation (#661)
* feat: add semantic-release automation and commit message validation - Configure semantic-release for automatic releases on main branch - Update GitHub Actions workflow to trigger releases on push to main - Add support for prerelease branches (beta, alpha, rc) - Install and configure commitlint for conventional commit validation - Set up husky pre-commit hooks for commit message validation - Update Node.js version to 20.x in release workflow - Add release scripts to package.json * feat: update semantic-release config for feature branch prereleases - Support prerelease versions from feature branches (feat-*, fix-*, chore-*) - Add semantic-release-monorepo for better monorepo support - Conditionally apply git plugin only on main branch - Remove beta/alpha/rc branches in favor of feature branch pattern * chore: remove semantic-release-monorepo dependency - Remove unnecessary semantic-release-monorepo package - Simplify release configuration by removing extends field - Keep feature branch prerelease support
1 parent 9e7f4fb commit ae98059

7 files changed

Lines changed: 715 additions & 38 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Release
22

33
on:
4+
push:
5+
branches:
6+
- main
47
workflow_dispatch:
58
inputs:
69
dryRun:
@@ -11,7 +14,8 @@ on:
1114
jobs:
1215
authorize:
1316
name: Authorize
14-
runs-on: ubuntu-18.04
17+
runs-on: ubuntu-latest
18+
if: github.event_name == 'workflow_dispatch'
1519
steps:
1620
- name: ${{ github.actor }} permission check to do a release
1721
uses: octokit/request-action@v2.x
@@ -23,15 +27,19 @@ jobs:
2327

2428
release:
2529
name: Release
26-
runs-on: ubuntu-18.04
30+
runs-on: ubuntu-latest
2731
needs: [authorize]
32+
if: always() && (needs.authorize.result == 'success' || needs.authorize.result == 'skipped')
2833
env:
29-
stable-node-version: "16.x"
34+
stable-node-version: "20.x"
3035
e2e-eslint-version: "eslint@8" # Used because e2e and benchmark tests use ESLint's Node.js API class introduced in eslint@7
3136

3237
steps:
3338
- name: Checkout
3439
uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
persist-credentials: false
3543

3644
- name: Setup Node.js
3745
uses: actions/setup-node@v4
@@ -46,15 +54,15 @@ jobs:
4654
run: npm test && npm run spec:e2e
4755

4856
- name: Release --dry-run # Uses release.config.js
49-
if: ${{ github.event.inputs.dryRun == 'true'}}
57+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.dryRun == 'true'}}
5058
env:
5159
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5260
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
5361
run: npx semantic-release --dry-run
5462

5563
- name: Release # Uses release.config.js
56-
if: ${{ github.event.inputs.dryRun == 'false'}}
64+
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.dryRun == 'false')}}
5765
env:
5866
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5967
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
60-
run: npx semantic-release
68+
run: npx semantic-release

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no -- commitlint --edit "$1"

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm test

commitlint.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
extends: ["@commitlint/config-conventional"],
3+
rules: {
4+
"type-enum": [
5+
2,
6+
"always",
7+
[
8+
"feat",
9+
"fix",
10+
"docs",
11+
"style",
12+
"refactor",
13+
"perf",
14+
"test",
15+
"build",
16+
"ci",
17+
"chore",
18+
"revert",
19+
],
20+
],
21+
"subject-case": [2, "never", ["sentence-case", "start-case", "pascal-case", "upper-case"]],
22+
},
23+
};

0 commit comments

Comments
 (0)