Skip to content

Commit a4b752e

Browse files
committed
npm publish github actions
1 parent de683f3 commit a4b752e

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/npm-publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish Package to npmjs
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
11+
- name: Find yarn cache location
12+
id: yarn-cache
13+
run: echo "::set-output name=dir::$(yarn cache dir)"
14+
15+
- name: JS package cache
16+
uses: actions/cache@v1
17+
with:
18+
path: $(( steps.yarn-cache.outputs.dir ))
19+
key: $(( runner.os ))-yarn-$(( hashFiles('**/yarn.lock') ))
20+
restore-keys: |
21+
$(( runner.os ))-yarn-
22+
23+
- name: Install Dependencies
24+
run: yarn install
25+
26+
- name: Compile the Library
27+
run: yarn build-lib
28+
# Setup .npmrc file to publish to npm
29+
- uses: actions/setup-node@v4
30+
with:
31+
node-version: '20.11.1'
32+
registry-url: 'https://registry.npmjs.org'
33+
- run: npm ci
34+
- run: npm publish
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)