diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 5522e2b..2012a0c 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,34 +1,35 @@ # 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: Node.js Package - +name: Release on: - release: - types: [created] + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: + - master + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: jobs: - build: + release: + if: github.event.repository.fork == false + name: Release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v2 with: - node-version: 16 - - run: npm install --package-lock-only - - run: npm ci - - run: npm test - - publish-npm: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + fetch-depth: 0 + persist-credentials: false + - name: Setup Node.js + uses: actions/setup-node@v2 with: node-version: 16 - registry-url: https://registry.npmjs.org/ - - run: npm ci - - run: npm publish + - name: Install dependencies + run: yarn ci:install + - name: Release env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + NPM_TOKEN: ${{ secrets.npm_token }} + run: yarn ci:shipit