From 3b1470b3585e2807fa507fef37501275b1169ef3 Mon Sep 17 00:00:00 2001 From: weareoutman Date: Sat, 24 Oct 2020 11:26:20 +0800 Subject: [PATCH] chore: update npm publish --- .github/workflows/npm-publish.yml | 38 ++++++++++++------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 07911fb9..dffee359 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,27 +1,19 @@ -on: - push: - branches: - - master name: npm-publish +on: + release: + types: [created] jobs: - npm-publish: + build: runs-on: ubuntu-latest steps: - # The logic below handles the npm publication: - - uses: actions/checkout@v2 - # these if statements ensure that a publication only occurs when - # a new release is created: - if: ${{ steps.release.outputs.release_created }} - - uses: actions/setup-node@v1 - with: - node-version: 12 - registry-url: 'https://registry.npmjs.org' - if: ${{ steps.release.outputs.release_created }} - - run: yarn install --frozen-lockfile - if: ${{ steps.release.outputs.release_created }} - - run: yarn build - if: ${{ steps.release.outputs.release_created }} - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - if: ${{ steps.release.outputs.release_created }} + - uses: actions/checkout@v2 + # Setup .npmrc file to publish to npm + - uses: actions/setup-node@v1 + with: + node-version: '12.x' + registry-url: 'https://registry.npmjs.org' + - run: yarn install --frozen-lockfile + - run: yarn build + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}