Skip to content

Commit a3235bf

Browse files
committed
added workflow for publishing npm package using pnpm
Signed-off-by: Scott Westover <scottwestover2006@gmail.com>
1 parent e96429a commit a3235bf

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Publish NPM Package
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
npm_token:
7+
required: true
8+
gh_token:
9+
required: true
10+
11+
jobs:
12+
npm-publish:
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
fail-fast: true
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Setup Node.js 18
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: "18.x"
25+
26+
- uses: pnpm/action-setup@v2
27+
name: Install pnpm
28+
with:
29+
version: 8
30+
31+
- name: install project dependencies
32+
run: pnpm install --frozen-lockfile
33+
34+
- name: build project
35+
run: pnpm build
36+
37+
- run: git config user.email "scottwestover2006@gmail.com"
38+
- run: git config user.name "@github-ci"
39+
- run: pnpm version --patch --message "Bump version to %s"
40+
41+
- run: git push
42+
- run: git push --follow-tags
43+
44+
- name: publish to npm
45+
run: |
46+
npm set //registry.npmjs.org/:_authToken ${{ secrets.npm_token }}
47+
pnpm publish:npm
48+
49+
- name: publish to github
50+
run: |
51+
npm config set registry https://npm.pkg.github.com
52+
npm set //npm.pkg.github.com/:_authToken ${{ secrets.gh_token }}
53+
pnpm publish:github

0 commit comments

Comments
 (0)