-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (38 loc) · 1.22 KB
/
npm.yaml
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
name: NPM Publish
on:
release:
types:
- published
jobs:
publish:
name: NPM Publish
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: https://registry.npmjs.org
- run: yarn install --immutable
- name: Retreive version from package.json
id: package-json
run: echo "version=$(cat package.json | jq '.version' --raw-output)" >> $GITHUB_OUTPUT
- name: Check versions match
if: format('v{0}', steps.package-json.outputs.version) != github.event.release.tag_name
uses: actions/github-script@v7
with:
script: core.setFailed('Release tag does not match package.json')
- run: yarn build
- name: Publish with latest tag
if: github.event.release.prelease == false
run: npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish with next tag
if: github.event.release.prelease == true
run: npm publish --tag next --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}