Skip to content

Merge pull request #75 from riyadhalnur/dependabot/npm_and_yarn/follo… #64

Merge pull request #75 from riyadhalnur/dependabot/npm_and_yarn/follo…

Merge pull request #75 from riyadhalnur/dependabot/npm_and_yarn/follo… #64

name: Node.js Package
on:
pull_request:
branches:
- master
push:
branches:
- master
release:
types: [published]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: ['18', '20', '21']
os: [ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
- run: npm i
- run: npm run build --if-present
- run: npm run lint --if-present
- run: npm test
publish-npm:
if: ${{ github.event_name == 'release' }}
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build --if-present
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
publish-gpr:
if: ${{ github.event_name == 'release' }}
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: npm run build --if-present
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}