Skip to content

Publish NPM

Publish NPM #43

Workflow file for this run

name: Publish NPM
on:
workflow_dispatch:
inputs:
packageVersion:
description: "npm package version to publish"
required: true
jobs:
publish:
name: publish npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18" # Specify the Node.js version if needed
- name: Install dependencies
run: npm install
- name: Build the project
run: npm run build
- name: Run tests
run: npm test
- name: Authenticate npm
run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
- name: Publish
run: |
npm version ${{ inputs.packageVersion }} --no-git-tag-version
npm publish --access public --registry https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
shell: bash