-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (36 loc) · 1.11 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Publish
on:
release:
types: [published]
jobs:
npm:
name: NPM
runs-on: ubuntu-latest
environment: NPM Release Publishing
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version-file: ".nvmrc"
cache: npm
- uses: actions/github-script@e3cbab99d3a9b271e1b79fc96d103a4a5534998c
id: version
with:
script: |
const semver = context.ref.replace('refs/tags/v', '')
if (semver.match(/^[0-9]+\.[0-9]+\.[0-9]+$/)) {
return semver
}
throw new Error('not semver')
result-encoding: string
- run: npm install
- run: npm run build
- name: Version
run: |
node ./version.cjs --version ${{ steps.version.outputs.result }}
- name: Publish
run: |
npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN
npm publish --access public
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}