-
Notifications
You must be signed in to change notification settings - Fork 7
60 lines (56 loc) · 2.62 KB
/
release.yml
File metadata and controls
60 lines (56 loc) · 2.62 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Release
on:
push:
tags:
# Latest release tags, e.g. "v2.0.0"
- 'v[0-9]+.[0-9]+.[0-9]+'
# Beta release tags, e.g. "v3.0.0-beta.1"
- 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
permissions:
contents: read
jobs:
Install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # https://github.com/actions/setup-node/releases/tag/v6.4.0
with:
node-version-file: .node-version
package-manager-cache: false
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # https://github.com/actions/cache/releases/tag/v5.0.5
id: cache-node_modules
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: npm ci
publish-npm:
name: Publish to npm
needs: Install
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # https://github.com/actions/checkout/releases/tag/v6.0.2
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # https://github.com/actions/setup-node/releases/tag/v6.4.0
with:
node-version-file: .node-version
package-manager-cache: false
registry-url: https://registry.npmjs.org
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # https://github.com/actions/cache/releases/tag/v5.0.5
id: cache-node_modules
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- run: npm run build
- name: npm publish (latest)
if: ${{ ! contains(github.ref_name, 'beta') }}
run: npm publish --provenance --access public
- name: npm publish (beta)
if: ${{ contains(github.ref_name, 'beta') }}
run: npm publish --provenance --access public --tag beta