Publish to npm #4
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: | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
# 检出代码 | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# 设置 pnpm | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: latest | |
# 设置 node | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
cache: pnpm | |
node-version: lts/* | |
registry-url: https://registry.npmjs.org | |
# 安装依赖 | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
# 发布到 npm | |
- name: Publish to npm | |
working-directory: ./packages/core | |
run: npm publish --provenance --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |