Skip to content

Commit

Permalink
add workflow for npm lib deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Dec 17, 2024
1 parent 7eee60f commit 07b912b
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/publish-lib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish Library to NPM

on:
release:
types: [created]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Build library
run: bun run build:lib
working-directory: .

- name: Create package.json for library
run: |
cd dist/lib
{
echo '{
"name": "@bluerobotics/cockpit-api",
"version": "'${{ github.ref_name }}'",
"main": "cockpit-external-api.umd.js",
"module": "cockpit-external-api.es.js",
"types": "types/index.d.ts",
"publishConfig": {
"access": "public"
}
}'
} > package.json
- name: Publish to NPM
run: npm publish
working-directory: dist/lib
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM }}

0 comments on commit 07b912b

Please sign in to comment.