-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (69 loc) · 1.8 KB
/
publish.yml
File metadata and controls
71 lines (69 loc) · 1.8 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
61
62
63
64
65
66
67
68
69
70
71
name: Node.js Package
on:
release:
types: [created]
workflow_dispatch:
jobs:
build:
env:
github_token: ${{ secrets.GH_PAT }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- name: install deps
run: npm ci
- name: run script
run: npm run build
- name: test
run: npm test
- name: save build files
uses: actions/upload-artifact@v2
with:
name: build-files
path: dist/
publish-npm:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
- name: download build files
uses: actions/download-artifact@v2
with:
name: build-files
path: dist/
- run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-gpr:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: 'https://npm.pkg.github.com'
scope: '@userfetch'
# https://github.com/actions/setup-node/issues/243#issuecomment-995742416
- run: npm init -y --scope ${{ github.repository_owner }}
- name: download build files
uses: actions/download-artifact@v2
with:
name: build-files
path: dist/
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}