Skip to content

Publish to NPM

Publish to NPM #1

Workflow file for this run

name: Publish to NPM
on:
push:
tags:
- 'v*' # 例如 v1.0.0,会触发发布流程
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org/'
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8 # 或者你使用的具体版本
run_install: false
- name: Install dependencies
run: pnpm install
- name: Run tests
run: pnpm test
- name: Build package
run: pnpm build
- name: Publish to npm
run: pnpm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}