From 3f6997739437051600e1fc65754bf63789627bd8 Mon Sep 17 00:00:00 2001 From: Hommy <16620803786@163.com> Date: Mon, 27 Jul 2026 22:36:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=89=93=E5=8C=85=E9=99=90?= =?UTF-8?q?=E5=88=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/desktop-client-dev.yml | 34 ++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/.github/workflows/desktop-client-dev.yml b/.github/workflows/desktop-client-dev.yml index dd31e33..36ada3c 100644 --- a/.github/workflows/desktop-client-dev.yml +++ b/.github/workflows/desktop-client-dev.yml @@ -4,11 +4,41 @@ on: push: tags: - 'v*' # 仅在推送 v 开头的 tag 时触发打包 - paths: - - 'desktop-client/**' # 只有该目录下的文件被修改时才触发 jobs: + # tag 推送时官方不评估 paths,用门禁 job 对比上一 v* tag + changes: + runs-on: ubuntu-latest + outputs: + desktop: ${{ steps.check.outputs.desktop }} + steps: + - name: 准备代码 + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: 检查 desktop-client 是否有变更 + id: check + run: | + CURRENT="${{ github.ref_name }}" + PREV=$(git tag -l 'v*' --sort=-v:refname | grep -vxF "$CURRENT" | head -n1 || true) + if [ -z "$PREV" ]; then + echo "No previous v* tag; will build." + echo "desktop=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + echo "Comparing $PREV..$GITHUB_SHA for desktop-client/" + if git diff --quiet "$PREV" "$GITHUB_SHA" -- desktop-client/; then + echo "No changes in desktop-client/; skip build." + echo "desktop=false" >> "$GITHUB_OUTPUT" + else + echo "desktop-client/ changed; will build." + echo "desktop=true" >> "$GITHUB_OUTPUT" + fi + build: + needs: changes + if: needs.changes.outputs.desktop == 'true' runs-on: ${{ matrix.os }} strategy: