Skip to content

Commit 8b336f1

Browse files
authored
publish to GPR & NPM
1 parent 441bc69 commit 8b336f1

File tree

1 file changed

+50
-6
lines changed

1 file changed

+50
-6
lines changed

.github/workflows/publish.yml

+50-6
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,68 @@
11
name: Publish
2+
23
on:
34
release:
45
types: [created]
6+
57
jobs:
68
publish-npm:
9+
name: Publish to npm
710
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
814
steps:
9-
- name: Checkout the project
10-
uses: actions/checkout@v3
11-
- name: Use Node.js 16.x (LTS)
12-
uses: actions/setup-node@v3
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-node@v3
1317
with:
14-
node-version: 16.x
18+
node-version: 18
1519
registry-url: https://registry.npmjs.org/
1620
cache: npm
1721
- run: npm ci
1822
- run: npm test
1923
- run: npm version ${TAG_NAME} --git-tag-version=false
2024
env:
2125
TAG_NAME: ${{ github.event.release.tag_name }}
22-
- run: npm whoami; npm publish --access public
26+
27+
# Provenance beta builds
28+
# Remove when stable
29+
- name: Clone npm
30+
uses: actions/checkout@v3
31+
with:
32+
repository: npm/cli
33+
ref: provenance
34+
path: npm
35+
- name: Link npm
36+
run: |
37+
cd npm
38+
node . link
39+
cd ..
40+
npm version
41+
# Provenance beta builds
42+
# Remove when stable
43+
44+
- run: npm whoami; npm --ignore-scripts publish --provenance --access public
2345
env:
2446
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
47+
publish-github:
48+
name: Publish to GitHub Packages
49+
runs-on: ubuntu-latest
50+
permissions:
51+
contents: read
52+
packages: write
53+
steps:
54+
- uses: actions/checkout@v3
55+
- uses: actions/setup-node@v3
56+
with:
57+
node-version: 18
58+
registry-url: https://npm.pkg.github.com
59+
cache: npm
60+
scope: '@github'
61+
- run: npm ci
62+
- run: npm test
63+
- run: npm version ${TAG_NAME} --git-tag-version=false
64+
env:
65+
TAG_NAME: ${{ github.event.release.tag_name }}
66+
- run: npm --ignore-scripts publish --access public
67+
env:
68+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)