.github/workflows/publish.yml
name: Manual Publish
on:
workflow_dispatch:
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16.18.0'
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: npm ci --force
- name: Build for production
run: npm run build:prod
- name: Publish to GitHub Packages
env:
GH_NPM_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run publish:gh
- name: Authenticate to NPMJS
run: echo -e '//registry.npmjs.org/:_authToken=${NPMJS_PUBLISH_TOKEN}' > .npmrc
- name: Publish to npm
env:
NPMJS_PUBLISH_TOKEN: ${{ secrets.NPMJS_PUBLISH_TOKEN }}
run: npm run publish:npm