This file contains 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
name: "Publish Package" | |
on: | |
workflow_call: | |
inputs: | |
git_ref_name: | |
description: 'The branch or tag name to publish' | |
required: true | |
default: 'main' | |
node_version: | |
description: 'The Node.js version to use' | |
required: true | |
default: '22' | |
node_auth_token: | |
description: 'The Node.js authentication token' | |
required: false | |
default: '' | |
node_registry_url: | |
description: 'The Node.js registry URL' | |
required: false | |
default: '' | |
node_scope: | |
description: 'The Node.js scope' | |
required: false | |
build_command: | |
description: 'Build command to run' | |
required: false | |
default: 'npm run build --if-present' | |
install_command: | |
description: 'Dependency install command to run' | |
required: false | |
default: 'npm ci' | |
publish_command: | |
description: 'Publish command to run' | |
required: false | |
default: 'npm publish' | |
secrets: | |
- node_auth_token | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.git_ref_name }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ inputs.node_version }} | |
registry-url: ${{ inputs.node_registry_url }} | |
scope: ${{ inputs.node_scope }} | |
- run: ${{ inputs.install_command }} | |
- run: ${{ inputs.build_command }} | |
- run: ${{ inputs.publish_command }} | |
env: | |
# This is the write access auth token for the npm registry; often just simply secrets.GITHUB_TOKEN | |
NODE_AUTH_TOKEN: ${{ secrets.node_auth_token }} |