| 1 | name: publish |
| 2 | |
| 3 | on: |
| 4 | release: |
| 5 | types: [published] |
| 6 | |
| 7 | jobs: |
| 8 | publish-npm: |
| 9 | runs-on: ubuntu-latest |
| 10 | steps: |
| 11 | - uses: actions/checkout@v2 |
| 12 | - uses: actions/setup-node@v1 |
| 13 | with: |
| 14 | node-version: 14 |
| 15 | registry-url: https://registry.npmjs.org/ |
| 16 | - run: npm install |
| 17 | - run: npm test |
| 18 | - name: Publish beta version to npm |
| 19 | if: "github.event.release.prerelease" |
| 20 | run: npm publish --tag beta |
| 21 | env: |
| 22 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 23 | - name: Publish to npm |
| 24 | if: "!github.event.release.prerelease" |
| 25 | run: npm publish |
| 26 | env: |
| 27 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |