Skip to content

fix: 导出

fix: 导出 #19

Workflow file for this run

name: Release and Publish
on:
push:
# 监听 main 分支的 push 事件
branches:
- main
# 赋予 release-please-action 权限
permissions:
contents: write
pull-requests: write
jobs:
# 设置 release-please 任务
release-please:
# 设置任务运行环境为 ubuntu-latest
runs-on: ubuntu-latest
defaults:
run:
# 为所有 run 步骤设置工作目录
working-directory: packages/core
steps:
# 使用 release-please-action 动作来自动创建发布 PR
- uses: googleapis/release-please-action@v4
id: release
with:
# 设置发布类型为 node
release-type: node
# 检出代码
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
# 设置 Node.js 环境
- uses: actions/setup-node@v4
with:
# 设置 Node.js 版本
node-version: 20
# 设置 npm 源
registry-url: "https://registry.npmjs.org"
if: ${{ steps.release.outputs.release_created }}
# 设置 pnpm
- name: 设置 pnpm
uses: pnpm/action-setup@v2
with:
version: 8
if: ${{ steps.release.outputs.release_created }}
# 使用 pnpm 安装依赖
- name: 安装依赖
run: pnpm install --no-frozen-lockfile
if: ${{ steps.release.outputs.release_created }}
# 构建输出
- run: pnpm build:prod
if: ${{ steps.release.outputs.release_created }}
# 发布到 npm
- run: npm run pub
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.release_created }}