Skip to content

Publish NPM package #157

Publish NPM package

Publish NPM package #157

Workflow file for this run

# Brief: Publish database branch as NPM package post successful testing
# Note: Must be run on default branch
# Ref: https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-nodejs-packages
name: Publish NPM package
on:
workflow_run: # Run whenever the Test workflow completes
workflows: [Test]
types: [completed]
jobs:
publish:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Check out database branch
uses: actions/checkout@v4
with:
ref: database
- name: Set up Node runtime and .npmrc
uses: actions/setup-node@v4
with:
node-version: '20.x'
check-latest: false
registry-url: 'https://registry.npmjs.org'
- name: Publish # Only if not up-to-date
run: |
if [ $(scripts/get-version.sh) != $(scripts/latest-version-npm.sh) ]; then
npm publish
else
echo 'Up-to-date. Nothing new to publish.'
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}