-
Notifications
You must be signed in to change notification settings - Fork 0
307 lines (259 loc) · 10.7 KB
/
Copy pathrelease.yml
File metadata and controls
307 lines (259 loc) · 10.7 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
name: Release Build
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
# ============================================================
# macOS: .app bundle + .dmg (arm64 + x64)
# ============================================================
build-macos:
name: macOS ${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: arm64
runner: macos-14
rid: osx-arm64
- arch: x64
runner: macos-15
rid: osx-x64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Get version
shell: bash
run: |
VERSION=${GITHUB_REF#refs/tags/v}
[[ "$VERSION" == refs/* ]] && VERSION=0.0.0-dev
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Publish (self-contained)
run: dotnet publish src/Taskly/Taskly.csproj -c Release -r ${{ matrix.rid }} --self-contained true -p:PublishSingleFile=true -p:Version=${{ env.VERSION }} -o publish
- name: Assemble .app bundle
shell: bash
run: |
mkdir -p "Taskly.app/Contents/MacOS"
mkdir -p "Taskly.app/Contents/Resources"
cp -R publish/* "Taskly.app/Contents/MacOS/"
# 写 Info.plist(用实际版本号替换占位)
sed 's/0\.3\.0/${{ env.VERSION }}/' packaging/macos/Info.plist > "Taskly.app/Contents/Info.plist"
chmod +x "Taskly.app/Contents/MacOS/Taskly"
# Ad-hoc 签名(无 Apple Developer 账号):让 macOS Gatekeeper 显示
# "无法验证开发者"而非误导性的"已损坏"。用户右键打开即可运行。
- name: Ad-hoc code sign
shell: bash
run: |
# 签名所有 Mach-O 二进制(self-contained 发布包含 .NET 运行时)
find "Taskly.app/Contents/MacOS" -type f -exec sh -c '
file "$1" | grep -q "Mach-O" && codesign --force --sign - "$1" 2>/dev/null || true
' _ {} \;
# 整体签名 .app bundle
codesign --force --deep --sign - "Taskly.app"
# 验证
codesign --verify --verbose=2 "Taskly.app" 2>&1 || true
# appdmg writes the .DS_Store binary directly (no Finder/AppleScript),
# producing a decorated DMG (background + /Applications link) in headless CI.
- name: Setup Node for appdmg
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup Python for background generation
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install appdmg
run: npm install -g appdmg
- name: Generate app icon
run: |
python3 -m pip install pillow
python3 packaging/macos/make_icon.py /tmp/taskly-icon-build
cp /tmp/taskly-icon-build/icon.icns "Taskly.app/Contents/Resources/icon.icns"
- name: Create .dmg (decorated, with retry)
shell: bash
run: |
chmod +x packaging/macos/create-dmg.sh
packaging/macos/create-dmg.sh \
"packaging/macos/dmg/spec.json" \
"taskly-${{ env.VERSION }}-macos-${{ matrix.arch }}.dmg"
- uses: actions/upload-artifact@v4
with:
name: taskly-macos-${{ matrix.arch }}
path: '*.dmg'
# ============================================================
# Windows: Setup.exe (Velopack)
# ============================================================
build-windows:
name: Windows x64
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Get version
shell: bash
run: |
VERSION=${GITHUB_REF#refs/tags/v}
[[ "$VERSION" == refs/* ]] && VERSION=0.0.0-dev
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Publish (self-contained)
run: dotnet publish src/Taskly/Taskly.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:Version=${{ env.VERSION }} -o publish
- name: Install Velopack
run: dotnet tool install -g vpk
- name: Create Setup.exe
shell: pwsh
run: |
$env:PATH = "$env:USERPROFILE\.dotnet\tools;$env:PATH"
# 诊断:确认 publish 目录内容
Write-Host "=== publish 目录 ==="
Get-ChildItem publish/*.exe | Format-Table Name, Length
# 运行 vpk(--icon 让 Setup.exe 和安装后的快捷方式显示 Taskly 图标)
vpk pack -u Taskly -v ${{ env.VERSION }} -p publish -e Taskly.exe -o build --icon src/Taskly/taskly.ico --verbose
- name: Rename to match platform naming convention
shell: pwsh
run: |
# Velopack 输出 Taskly-{version}-win-x64-Setup.exe 或类似名称,
# 统一改为 taskly-{version}-windows-x64.exe 与其他平台一致。
$src = Get-ChildItem build/*-Setup.exe | Select-Object -First 1
if (-not $src) { $src = Get-ChildItem build/*.exe | Select-Object -First 1 }
if ($src) {
$dst = "taskly-${{ env.VERSION }}-windows-x64.exe"
Copy-Item $src.FullName $dst
Write-Host "Renamed: $($src.Name) -> $dst"
}
- uses: actions/upload-artifact@v4
with:
name: taskly-windows-x64
path: 'taskly-*-windows-x64.exe'
# ============================================================
# Linux: .AppImage + .deb
# ============================================================
build-linux:
name: Linux x64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Get version
shell: bash
run: |
VERSION=${GITHUB_REF#refs/tags/v}
[[ "$VERSION" == refs/* ]] && VERSION=0.0.0-dev
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Publish (self-contained)
run: dotnet publish src/Taskly/Taskly.csproj -c Release -r linux-x64 --self-contained true -p:PublishSingleFile=true -p:Version=${{ env.VERSION }} -o publish
# --- AppImage ---
- name: Install FUSE for AppImage
run: sudo apt-get update && sudo apt-get install -y libfuse2
- name: Build AppImage
shell: bash
run: |
# 组装 AppDir(appimagetool 要求 .desktop 在根目录)
mkdir -p AppDir/usr/bin
cp -R publish/* AppDir/usr/bin/
chmod +x AppDir/usr/bin/Taskly
# .desktop 必须在 AppDir 根目录
cp packaging/linux/taskly.desktop AppDir/taskly.desktop
# 图标(appimagetool 要求 Icon=taskly 对应 taskly.png 存在)
cp packaging/linux/taskly.png AppDir/taskly.png
cp packaging/linux/AppRun AppDir/AppRun
chmod +x AppDir/AppRun
# 下载 appimagetool
wget -q "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O appimagetool
chmod +x appimagetool
# 生成 AppImage(CI 环境用 APPIMAGE_EXTRACT_AND_RUN 绕过 FUSE)
ARCH=x86_64 APPIMAGE_EXTRACT_AND_RUN=1 ./appimagetool AppDir "taskly-${{ env.VERSION }}-linux-x64.AppImage"
ls -la *.AppImage
# --- .deb ---
- name: Build .deb
shell: bash
run: |
VERSION=${{ env.VERSION }}
STAGING="deb-staging"
mkdir -p "$STAGING/usr/bin"
mkdir -p "$STAGING/usr/lib/taskly"
mkdir -p "$STAGING/usr/share/applications"
mkdir -p "$STAGING/DEBIAN"
# 可执行文件 + 运行时(self-contained)
cp -R publish/* "$STAGING/usr/lib/taskly/"
chmod +x "$STAGING/usr/lib/taskly/Taskly"
# 启动脚本(转发到 self-contained 可执行文件)
cat > "$STAGING/usr/bin/taskly" << 'EOF'
#!/bin/sh
exec /usr/lib/taskly/Taskly "$@"
EOF
chmod +x "$STAGING/usr/bin/taskly"
# .desktop 文件(Exec 指向启动脚本)
sed 's|Exec=Taskly|Exec=/usr/bin/taskly|' packaging/linux/taskly.desktop > "$STAGING/usr/share/applications/taskly.desktop"
# control 文件(用实际版本号)
sed "s/@VERSION@/$VERSION/" packaging/linux/control > "$STAGING/DEBIAN/control"
# 构建 .deb
dpkg-deb --root-owner-group --build "$STAGING" "taskly-${{ env.VERSION }}-linux-x64.deb"
ls -la *.deb
- uses: actions/upload-artifact@v4
with:
name: taskly-linux-x64
path: |
*.AppImage
*.deb
# ============================================================
# Release: 收集所有产物,创建 GitHub Release
# ============================================================
release:
name: Create Release
needs: [build-macos, build-windows, build-linux]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- name: Get version
shell: bash
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=$VERSION" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: List artifacts
shell: bash
run: find artifacts -type f
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/*.dmg
artifacts/*.exe
artifacts/*.AppImage
artifacts/*.deb
name: Release v${{ env.VERSION }}
body: |
## Downloads
### macOS
- `taskly-${{ env.VERSION }}-macos-arm64.dmg` (Apple Silicon)
- `taskly-${{ env.VERSION }}-macos-x64.dmg` (Intel)
> **首次打开提示**:Taskly 尚未经过 Apple 公证。安装后若提示"无法打开"或"已损坏",
> 请在终端执行:`xattr -cr /Applications/Taskly.app`
> 然后即可正常打开。
>
> **First launch**: Taskly is not yet notarized by Apple. If macOS says the app
> is "damaged" or "can't be opened", run this in Terminal:
> `xattr -cr /Applications/Taskly.app`
### Windows
- `taskly-${{ env.VERSION }}-windows-x64.exe` (Setup installer)
### Linux
- `taskly-${{ env.VERSION }}-linux-x64.AppImage` (zero-install)
- `taskly-${{ env.VERSION }}-linux-x64.deb` (Debian/Ubuntu)
---
*Release notes are automatically generated.*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}