添加打包限制。

This commit is contained in:
Hommy
2026-07-27 22:36:34 +08:00
parent 0cddf442af
commit 3f69977394
+32 -2
View File
@@ -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: