Publish NPM package #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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] | |
workflow_dispatch: # Enables manual triggering | |
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 | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |