Publish Package to npmjs #34
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 to npmjs | |
# Controls when the action will run. Workflow runs when manually triggered using the UI | |
# or API. | |
on: | |
workflow_dispatch: | |
# Inputs the workflow accepts. | |
inputs: | |
pkg: | |
description: 'Project To Publish (esm or node). Ensure version is updated & tagged' | |
default: 'node' | |
required: true | |
tag: | |
description: 'Branch or tag' | |
default: 'main' | |
required: true | |
jobs: | |
install_and_publish: | |
name: Install production dependencies and publish to npm | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: [ '18' ] # lts? | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.tag }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
registry-url: 'https://registry.npmjs.org' | |
# Setup .npmrc file to publish to npm | |
- run: echo checking out branch/tag ${GITHUB_REF##*/} | |
# - run: npm install --production --workspace=libs/${{ github.event.inputs.pkg }} # NOT NEEDED CURRENTLY | |
- run: npm publish --workspace=libs/${{ github.event.inputs.pkg }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |