This repository has been archived by the owner on Jan 2, 2025. It is now read-only.
Publish to NPM #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to NPM | |
on: | |
workflow_dispatch: | |
inputs: | |
release: | |
types: [created] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Set node version | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
registry-url: "https://registry.npmjs.org" | |
- name: Set pnpm version | |
uses: pnpm/action-setup@v3 | |
with: | |
run_install: false | |
version: 7 | |
- name: Cache node_modules | |
id: node-modules-cache | |
uses: actions/cache@v4 | |
with: | |
path: "**/node_modules" | |
key: node-modules-cache-${{ hashFiles('**/pnpm-lock.yaml') }} | |
- name: Install dependencies | |
if: steps.node-modules-cache.outputs.cache-hit != 'true' | |
run: pnpm install --no-frozen-lockfile | |
- name: Build resource | |
run: pnpm build | |
- name: Publish package | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |