Skip to content

Commit 70ea8cf

Browse files
committed
Switch to semantic-release
This will help with automatic releases.
1 parent c73553e commit 70ea8cf

File tree

3 files changed

+28
-25
lines changed

3 files changed

+28
-25
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
tags:
8-
- '[0-9]+.[0-9]+.[0-9]+'
97
jobs:
108
build:
119
name: build
@@ -24,34 +22,16 @@ jobs:
2422
- name: Install packages
2523
run: npm i
2624
- name: Run tests
27-
if: (!startsWith(github.ref, 'refs/tags/')) # run on all but tags
2825
run: npm test
2926
- name: Report coverage
30-
if: (!startsWith(github.ref, 'refs/tags/')) # run on all but tags
3127
uses: coverallsapp/[email protected]
3228
with:
3329
github-token: ${{github.token}}
3430
- name: Run build
3531
run: npm run build
36-
- name: Get previous package info
37-
if: startsWith(github.ref, 'refs/tags/') # run on only tags
38-
id: previous-package
39-
run: |
40-
NAME=$(node -pe "require('./package.json').name")
41-
VERSION=$(npm show ${NAME} version)
42-
echo "##[set-output name=NAME;]${NAME}"
43-
echo "##[set-output name=VERSION;]${VERSION}"
44-
echo "##[set-output name=ID;]${NAME}@${VERSION}"
45-
- name: Publish new package
46-
if: startsWith(github.ref, 'refs/tags/') # run on only tags
47-
run: npm publish
32+
- name: Release
33+
if: github.ref == 'refs/heads/master' # run on only master
34+
run: npx semantic-release
4835
env:
49-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
50-
- name: Deprecate previous package
51-
if: startsWith(github.ref, 'refs/tags/') # run on only tags
52-
run: >
53-
npm deprecate
54-
${{steps.previous-package.outputs.ID}}
55-
"Version no longer supported. Upgrade to @latest."
56-
env:
57-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
36+
GITHUB_TOKEN: ${{github.token}}
37+
NPM_TOKEN: ${{secrets.NPM_TOKEN}}

.releaserc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"tagFormat": "${version}",
3+
"branches": [
4+
"main"
5+
],
6+
"plugins": [
7+
"@semantic-release/commit-analyzer",
8+
"@semantic-release/github",
9+
"@semantic-release/npm",
10+
"@semantic-release/release-notes-generator",
11+
[
12+
"@semantic-release/git",
13+
{
14+
"assets": [
15+
"package.json"
16+
],
17+
"message": "chore(release): ${nextRelease.version}"
18+
}
19+
]
20+
]
21+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"@babel/core": "^7.11.6",
4040
"@babel/preset-env": "^7.11.5",
4141
"@babel/register": "^7.11.5",
42+
"@semantic-release/git": "^9.0.0",
4243
"babel-plugin-add-module-exports": "^1.0.2",
4344
"chai": "^4.2.0",
4445
"eslint": "^7.8.1",
@@ -47,6 +48,7 @@
4748
"eslint-plugin-mocha": "^8.0.0",
4849
"mocha": "^8.1.3",
4950
"nyc": "^15.1.0",
51+
"semantic-release": "^17.1.1",
5052
"sinon": "^9.0.3"
5153
}
5254
}

0 commit comments

Comments
 (0)