diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 224f2dd..6cdebaf 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,35 +1,33 @@ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages -name: Release +name: Node.js Package + on: - # Triggers the workflow on push or pull request events but only for the master branch - push: - branches: - - main - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + release: + types: [created] jobs: - release: - if: github.event.repository.fork == false - name: Release + build: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - fetch-depth: 0 - persist-credentials: false - - name: Setup Node.js - uses: actions/setup-node@v2 + node-version: 16 + - run: npm ci + - run: npm test + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: 16 - - name: Install dependencies - run: yarn ci:install - - name: Release + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm publish env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - NPM_TOKEN: ${{ secrets.npm_token }} - run: yarn ci:shipit + NODE_AUTH_TOKEN: ${{secrets.npm_token}}