Skip to content

Publish Package to npmjs #22

Publish Package to npmjs

Publish Package to npmjs #22

Workflow file for this run

name: Publish Package to npmjs
on:
workflow_dispatch:
inputs:
version:
description: 'Version to publish [<newversion> | major | minor | patch ]'
required: true
default: 'patch'
jobs:
publish-to-npmjs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
- name: Setup node
uses: actions/setup-node@v4
env:
NODE_VERSION: current
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
- name: Setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Clean installation
run: npm ci
- name: Create new version
run: npm version ${{ github.event.inputs.version }} -m "Upgrade to version %s"
- name: Publish to npmjs
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Commit the new version
run: |
git push origin main
git push --tags