Skip to content

Commit 308a901

Browse files
add workflow for npm lib deployment
1 parent afa9a35 commit 308a901

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/publish-lib.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish Library to NPM
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: '20'
16+
registry-url: 'https://registry.npmjs.org'
17+
18+
- uses: oven-sh/setup-bun@v1
19+
with:
20+
bun-version: latest
21+
22+
- name: Install dependencies
23+
run: bun install --frozen-lockfile
24+
25+
- name: Build library
26+
run: bun run build:lib
27+
working-directory: ./cockpit
28+
29+
- name: Create package.json for library
30+
run: |
31+
cd cockpit/dist/lib
32+
{
33+
echo '{
34+
"name": "@bluerobotics/cockpit-api",
35+
"version": "'${{ github.ref_name }}'",
36+
"main": "cockpit-external-api.umd.js",
37+
"module": "cockpit-external-api.es.js",
38+
"types": "types/index.d.ts",
39+
"publishConfig": {
40+
"access": "public"
41+
}
42+
}'
43+
} > package.json
44+
45+
- name: Publish to NPM
46+
run: npm publish
47+
working-directory: ./cockpit/dist/lib
48+
env:
49+
NODE_AUTH_TOKEN: ${{ secrets.NPM }}

0 commit comments

Comments
 (0)