mirror of
https://github.com/linshenkx/prompt-optimizer.git
synced 2026-07-01 02:14:52 +08:00
ci: gate docker and release on tests
Make docker builds and desktop releases depend on the shared test workflow to avoid duplicate runs and ensure only tested revisions ship.
This commit is contained in:
30
.github/workflows/docker.yml
vendored
30
.github/workflows/docker.yml
vendored
@@ -1,11 +1,9 @@
|
||||
name: Docker Build and Push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'docs/**'
|
||||
workflow_run:
|
||||
workflows: [ test ]
|
||||
types: [ completed ]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
@@ -19,6 +17,7 @@ env:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: ${{ github.event_name == 'workflow_dispatch' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && (github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'master')) }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -27,27 +26,8 @@ jobs:
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 安装 pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 10.5.2
|
||||
run_install: false
|
||||
|
||||
- name: 设置 Node.js 环境
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: 安装依赖
|
||||
run: pnpm install
|
||||
|
||||
- name: 运行构建
|
||||
run: pnpm build
|
||||
|
||||
- name: 运行测试
|
||||
run: pnpm test
|
||||
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
|
||||
|
||||
- name: 获取package.json版本号
|
||||
id: version
|
||||
|
||||
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@@ -17,8 +17,12 @@ env:
|
||||
PNPM_VERSION: '10.6.1'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
uses: ./.github/workflows/test.yml
|
||||
|
||||
# 构建 Windows 版本
|
||||
build-windows:
|
||||
needs: test
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: 检出代码
|
||||
@@ -152,6 +156,7 @@ jobs:
|
||||
|
||||
# 构建 macOS 版本
|
||||
build-macos:
|
||||
needs: test
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: 检出代码
|
||||
@@ -278,6 +283,7 @@ jobs:
|
||||
|
||||
# 构建 Linux 版本
|
||||
build-linux:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 检出代码
|
||||
|
||||
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
@@ -12,6 +12,7 @@ on:
|
||||
- '**.md'
|
||||
- 'docs/**'
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
||||
Reference in New Issue
Block a user