Publish NPM #43
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 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 |