Skip to content

Commit

Permalink
feat!: v1
Browse files Browse the repository at this point in the history
  • Loading branch information
sj817 committed Jan 15, 2025
1 parent c8fb918 commit bd98d62
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Release and Publish
on:
push:
# 监听 dev 分支的 push 事件
# 监听 main 分支的 push 事件
branches:
- dev
- main
# 赋予 release-please-action 权限
permissions:
contents: write
Expand All @@ -13,15 +13,17 @@ jobs:
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
# 设置发布PR分支
default-branch: dev
# 检出代码
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
Expand All @@ -32,16 +34,19 @@ jobs:
node-version: 20
# 设置 npm 源
registry-url: "https://registry.npmjs.org"
# 安装依赖 不安装对等依赖
- run: npm install --config.auto-install-peers=false --ignore-scripts --omit=peer
env:
NODE_AUTH_TOKEN: ${{ secrets.RELEASE }}
if: ${{ steps.release.outputs.release_created }}
# 构建输出
- run: npm run build
# 设置 pnpm
- name: 设置 pnpm
uses: pnpm/action-setup@v2
with:
version: 8
if: ${{ steps.release.outputs.release_created }}
# 删除开发依赖、对等依赖
- run: npm run pr clean
# 使用 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
Expand Down

0 comments on commit bd98d62

Please sign in to comment.