Skip to content

Publish Package to npmjs #23

Publish Package to npmjs

Publish Package to npmjs #23

Workflow file for this run

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 }}