Skip to content

Node.js Package

Node.js Package #4

Workflow file for this run

# 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
on:
release:
types: [published]
workflow_dispatch:
permissions:
id-token: write # Required for OIDC
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
submodules: 'true'
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install
- run: npm test
publish-npm:
environment: deploy
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
submodules: 'true'
- uses: actions/setup-node@v6
with:
node-version: 20
registry-url: 'https://registry.npmjs.org/'
- name: Update npm
run: npm install -g npm@latest
- run: npm install
- run: npm run build --if-present
- run: npm test
- run: npm publish
publish-gh-pkgs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
submodules: 'true'
- uses: actions/setup-node@v6
with:
node-version: 20
registry-url: 'https://npm.pkg.github.com'
- name: Update npm
run: npm install -g npm@latest
- run: npm install
- run: npm run build --if-present
- run: npm test
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}