From d531f8c4ae0f0fcce515cce2fe2db3ea1e828e29 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Fri, 9 Aug 2024 11:32:18 -0400 Subject: [PATCH] Add npm publish action (#64) --- .github/workflows/publish.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..2754212a1 --- /dev/null +++ b/.github/workflows/publish.yml @@ -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 }}