Skip to content

Publish NPM package and deploy docs to Pages #30

Publish NPM package and deploy docs to Pages

Publish NPM package and deploy docs to Pages #30

Workflow file for this run

# Simple workflow for deploying static content to GitHub Pages
name: Publish NPM package and deploy docs to Pages
on:
workflow_dispatch:
inputs:
version:
description: 'Version bump type'
required: true
default: 'patch'
type: choice
options:
- major
- minor
- patch
- premajor
- preminor
- prepatch
- prerelease
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/string-fingerings
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: npm install
- name: Version package
run: npm version ${{ github.event.inputs.version }}
- name: Push commit
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git commit -am "Bump release version (${{ github.event.inputs.version }})"
git push
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'
- name: Publish package
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: List dist
run: ls dist
- name: Generate docs
run: npm run docs
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: ./packages/string-fingerings/docs
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4