Skip to content

Commit 3941e01

Browse files
authored
ci: add semantic-release (#260)
1 parent c52e21f commit 3941e01

File tree

3 files changed

+2418
-49
lines changed

3 files changed

+2418
-49
lines changed

.github/workflows/ci.yaml

+57-1
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,66 @@ jobs:
6262
files: coverage/lcov.info
6363
fail_ci_if_error: true
6464

65+
build:
66+
name: "Build"
67+
runs-on: ubuntu-latest
68+
steps:
69+
- name: "Checkout"
70+
uses: actions/checkout@v3
71+
with:
72+
fetch-depth: 0
73+
74+
- uses: actions/setup-node@v3
75+
with:
76+
node-version: 16
77+
78+
- uses: bahmutov/npm-install@v1
79+
with:
80+
useRollingCache: true
81+
install-command: yarn --frozen-lockfile
82+
83+
- name: "Build"
84+
run: yarn build
85+
86+
semantic-release:
87+
name: "Release"
88+
runs-on: ubuntu-latest
89+
needs: [ "lint", "test", "build" ]
90+
permissions:
91+
pull-requests: write
92+
contents: write
93+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
94+
outputs:
95+
new-release-published: ${{ steps.release.outputs.new-release-published }}
96+
steps:
97+
- name: "Checkout"
98+
uses: actions/checkout@v3
99+
with:
100+
fetch-depth: 0
101+
102+
- uses: actions/setup-node@v3
103+
with:
104+
node-version: 16
105+
106+
- uses: bahmutov/npm-install@v1
107+
with:
108+
useRollingCache: true
109+
install-command: yarn --frozen-lockfile
110+
111+
- name: "Build package"
112+
run: yarn build
113+
114+
- name: "Release"
115+
id: "release"
116+
uses: codfish/[email protected]
117+
env:
118+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
120+
65121
dependabot-merge:
66122
name: "Dependabot automerge"
67123
runs-on: ubuntu-latest
68-
needs: [ "test", "lint" ]
124+
needs: [ "lint", "test", "build" ]
69125
permissions:
70126
pull-requests: write
71127
contents: write

package.json

+14
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
"@babel/preset-env": "^7.18.9",
5050
"@jamesacarr/eslint-formatter-github-actions": "^0.1.0",
5151
"@react-hookz/eslint-config": "^1.6.1",
52+
"@semantic-release/changelog": "^6.0.1",
53+
"@semantic-release/git": "^10.0.1",
54+
"@semantic-release/github": "^8.0.5",
5255
"@types/jasmine": "^4.0.3",
5356
"@types/karma": "^6.3.3",
5457
"@types/react": "^17",
@@ -68,6 +71,7 @@
6871
"rollup": "^2.77.0",
6972
"rollup-plugin-babel": "^4.4.0",
7073
"rollup-plugin-typescript2": "^0.32.1",
74+
"semantic-release": "^19.0.3",
7175
"simulant": "^0.2.2",
7276
"tslib": "^2.4.0",
7377
"typescript": "^4.7.4"
@@ -81,5 +85,15 @@
8185
"devserver": "cd ./testbench && npm i && npm run devserver",
8286
"build": "rimraf ./dist && rollup --config",
8387
"test": "cross-env NODE_ENV=production karma start"
88+
},
89+
"release": {
90+
"plugins": [
91+
"@semantic-release/commit-analyzer",
92+
"@semantic-release/release-notes-generator",
93+
"@semantic-release/changelog",
94+
"@semantic-release/npm",
95+
"@semantic-release/git",
96+
"@semantic-release/github"
97+
]
8498
}
8599
}

0 commit comments

Comments
 (0)