Skip to content

Publish

Publish #73

Workflow file for this run

env: {}
# FILE GENERATED WITH: npx ghat fregante/ghatemplates/npm-publish
# SOURCE: https://github.com/fregante/ghatemplates
# Collaborators can publish a new version of what's on master via "workflow_dispatch"
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
name: Publish
on:
workflow_dispatch:
inputs:
Version:
description: 'Version accepted by `npm version *`'
required: true
jobs:
NPM:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org
- run: npm ci || npm install
- uses: fregante/setup-git-user@v2
- name: Create version
# Get the generated version, this enables support for keywords: `npm version patch`
run: |
VERSION="$(npm version "${{ github.event.inputs.Version }}")"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: git push --follow-tags
- run: gh release create "$VERSION" --generate-notes
env:
GH_TOKEN: ${{ github.token }}