Skip to content

Commit c078fea

Browse files
committed
feat: add semantic release
1 parent 53d09aa commit c078fea

File tree

3 files changed

+2394
-36
lines changed

3 files changed

+2394
-36
lines changed

.github/workflows/release.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
3+
on: push
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
timeout-minutes: 10
9+
10+
strategy:
11+
matrix:
12+
node-version: [18.x]
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- name: Build
21+
run: |
22+
yarn install
23+
yarn build
24+
25+
- name: Test
26+
run: |
27+
yarn test:ci
28+
29+
30+
release:
31+
runs-on: ubuntu-latest
32+
timeout-minutes: 10
33+
34+
needs: test
35+
36+
if: |
37+
contains(github.ref, 'main')
38+
39+
strategy:
40+
matrix:
41+
node-version: [18.x]
42+
43+
steps:
44+
- uses: actions/checkout@v3
45+
- name: Use Node.js ${{ matrix.node-version }}
46+
uses: actions/setup-node@v3
47+
with:
48+
node-version: ${{ matrix.node-version }}
49+
- name: Build
50+
run: |
51+
yarn install
52+
yarn build
53+
env:
54+
NPM_TOKEN: ${{secrets.DEPLOY_SYSTEMS_TOKEN}}
55+
56+
- name: Release
57+
run: npx semantic-release
58+
env:
59+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
60+
NPM_TOKEN: ${{secrets.NPM_TOKEN}}

package.json

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"build:watch": "tsc --watch",
1818
"lint": "eslint --fix src/ tests/",
1919
"prepare": "husky install",
20+
"prepublishOnly": "yarn test:ci",
2021
"test": "jest --watchAll",
2122
"test:ci": "jest"
2223
},
@@ -28,6 +29,8 @@
2829
"devDependencies": {
2930
"@commitlint/cli": "^18.4.2",
3031
"@commitlint/config-conventional": "^18.4.2",
32+
"@semantic-release/changelog": "^6.0.3",
33+
"@semantic-release/git": "^10.0.1",
3134
"@types/jest": "^29.5.8",
3235
"@typescript-eslint/eslint-plugin": "^6.11.0",
3336
"@typescript-eslint/parser": "^6.11.0",
@@ -44,6 +47,7 @@
4447
"lint-staged": "^15.1.0",
4548
"prettier": "^3.1.0",
4649
"rimraf": "^5.0.5",
50+
"semantic-release": "^22.0.8",
4751
"ts-jest": "^29.1.1",
4852
"typescript": "^5.2.2"
4953
},
@@ -107,6 +111,29 @@
107111
]
108112
},
109113
"jest": {
110-
"preset": "ts-jest"
114+
"preset": "ts-jest",
115+
"collectCoverage": true,
116+
"collectCoverageFrom": [
117+
"./src/**"
118+
],
119+
"coverageReporters": [
120+
"html",
121+
"text"
122+
]
123+
},
124+
"release": {
125+
"branches": [
126+
"main"
127+
],
128+
"dryRun": false,
129+
"ci": true,
130+
"plugins": [
131+
"@semantic-release/commit-analyzer",
132+
"@semantic-release/release-notes-generator",
133+
"@semantic-release/npm",
134+
"@semantic-release/git",
135+
"@semantic-release/changelog",
136+
"@semantic-release/github"
137+
]
111138
}
112139
}

0 commit comments

Comments
 (0)