-
Notifications
You must be signed in to change notification settings - Fork 6
100 lines (86 loc) · 3.01 KB
/
Copy pathrelease.yml
File metadata and controls
100 lines (86 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Build & Release
# 触发条件:
# - 推送形如 v1.2.3 的 tag 时自动构建并发布
# - 也支持在 Actions 页面手动触发 (workflow_dispatch) 做构建冒烟, 不发布
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write # 创建 Release / 上传 Assets 需要
# 强制所有 JavaScript action 用 Node 24 运行, 消除 Node 20 弃用警告
# (部分 action 如 upload-artifact@v5 内部仍用 Node 20, GitHub 2026-06 起默认切 Node 24)
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build:
name: Build ${{ matrix.label }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
label: windows-x86_64
artifact_glob: dist/DeltaLab
archive_ext: zip
- os: macos-14 # Apple Silicon (arm64)
label: macos-arm64
artifact_glob: dist/DeltaLab.app
archive_ext: zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install "pyinstaller>=6.14"
- name: Build with PyInstaller
run: pyinstaller --noconfirm deltalab.spec
# Windows: 压缩 dist/DeltaLab 整个目录为 zip
- name: Package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$name = "DeltaLab-${{ github.ref_name }}-${{ matrix.label }}.zip"
Compress-Archive -Path dist/DeltaLab/* -DestinationPath $name
echo "ASSET_PATH=$name" | Out-File -FilePath $env:GITHUB_ENV -Append
# macOS: 对 .app 打 zip (用 ditto 保留 Bundle 权限)
- name: Package (macOS)
if: runner.os == 'macOS'
run: |
NAME="DeltaLab-${{ github.ref_name }}-${{ matrix.label }}.zip"
# 去除 Gatekeeper 隔离标记 (用户侧首次打开时仍可能需要右键打开)
xattr -cr dist/DeltaLab.app || true
ditto -c -k --sequesterRsrc --keepParent dist/DeltaLab.app "$NAME"
echo "ASSET_PATH=$NAME" >> "$GITHUB_ENV"
- name: Upload workflow artifact
uses: actions/upload-artifact@v5
with:
name: DeltaLab-${{ matrix.label }}
path: ${{ env.ASSET_PATH }}
if-no-files-found: error
release:
name: Publish GitHub Release
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v6
with:
path: artifacts
- name: List downloaded artifacts
run: find artifacts -maxdepth 3 -type f
- name: Create / Update GitHub Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/**/*.zip
draft: false
prerelease: false
generate_release_notes: true