Add npm publish action (#64)

This commit is contained in:
Chenlei Hu
2024-08-09 11:32:18 -04:00
committed by GitHub
parent 16a3d384b6
commit d531f8c4ae

28
.github/workflows/publish.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: Publish to npm
on:
pull_request:
types: [closed]
branches:
- main
- master
paths:
- "package.json"
jobs:
publish:
runs-on: ubuntu-latest
if: >
github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'Release')
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: lts/*
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}