Skip to content

Commit 93fd762

Browse files
committed
New release infrastructure
- use release-it to bump and tag - push tag to github - github action will create github release and publish on npm.js
1 parent 4738e9c commit 93fd762

File tree

5 files changed

+2277
-90
lines changed

5 files changed

+2277
-90
lines changed

.github/workflows/node.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [14.x, 15.x]
19+
node-version: [14.x, 16.x]
2020

2121
steps:
2222
- uses: actions/checkout@v2

.github/workflows/npm-publish.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: release
2+
on:
3+
push:
4+
# Enable when testing release infrastructure on a branch.
5+
branches:
6+
- build
7+
tags:
8+
- 'v[0-9]+.[0-9]+.[0-9]+'
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-node@v2
15+
with:
16+
node-version: 16
17+
- run: npm ci
18+
- run: npm test
19+
20+
create-release:
21+
needs: test
22+
runs-on: ubuntu-latest
23+
env:
24+
# Set to force version number, e.g., when no tag exists.
25+
PKG_VERSION: ''
26+
steps:
27+
- name: Get the release version from the tag
28+
if: env.PKG_VERSION == ''
29+
run: |
30+
# Apparently, this is the right way to get a tag name. Really?
31+
#
32+
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
33+
echo "PKG_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
34+
echo "version is: ${{ env.PKG_VERSION }}"
35+
36+
- name: Create GitHub release
37+
id: release
38+
uses: actions/create-release@v1
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
with:
42+
tag_name: ${{ env.PKG_VERSION }}
43+
release_name: ${{ env.PKG_VERSION }}
44+
45+
publish-npm:
46+
needs: test
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v2
50+
- uses: actions/setup-node@v2
51+
with:
52+
node-version: 16
53+
registry-url: 'https://registry.npmjs.org'
54+
- run: npm ci
55+
- run: npm publish
56+
env:
57+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

0 commit comments

Comments
 (0)