Skip to content

Publish to npm

Publish to npm #17

Workflow file for this run

name: Publish to npm
on:
workflow_dispatch:
inputs:
version:
description: 'npm version to publish'
type: choice
required: true
options:
# these are defined in ${{vars.versions}}, but ghw doesn't support yet the use of expressions in inputs.
- 'patch (x.y.z+1, bug fixes)'
- 'minor (x.y+1.0, new functionality)'
- 'major (x+1.0.0, api breaking changes)'
dry_run:
description: 'Perform all steps except npm publish'
type: boolean
default: true
required: true
jobs:
build:
if: false
uses: ./.github/workflows/build.yml
publish-npm:
# needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
ref: github-workflows
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
#- run: npm run dist
- name: Version package
run: |
npm version ${{env.PKG_VERSION}}
git push
env:
PKG_VERSION: ${{fromJSON(vars.versions).values[inputs.version]}}
- name: Publish to npm
if: inputs.dry_run == false
run: echo "npm publish"
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}