Files
Ydisks-Xianyu-Helper/.github/workflows/desktop-cd.yml
T
Christ d36c357bab 完善 Docker 发布与桌面安装包流水线
- 固定 Docker 与测试镜像使用 Node.js 24 trixie slim 基础镜像。

- 安装 Chromium 所需系统运行库,并清理 apt 索引、缓存和临时文件,降低最终镜像体积。

- 增加 Chromium 实际启动、服务健康检查以及 Go 和前端测试门禁,门禁通过后才发布镜像标签。

- 修复 v1.2.3 版本标签触发,自动构建版本镜像、各平台安装包并创建 GitHub Release。

- 完善版本产物校验、SHA256SUMS 校验和以及正式版本标签规则。

- 将 Linux、Windows、macOS 和 Docker 的 Playwright runtime 缓存改为独立恢复与立即保存。

- 修复 Chromium runtime 校验中的绝对路径问题,并补充平台与安装器源码缓存键。

- 同步更新发布文档、打包规范和前端路由测试断言。
2026-08-12 23:40:52 +08:00

537 lines
24 KiB
YAML

name: 构建桌面端安装包
on:
push:
branches:
- main
- codex/desktop-packaging
tags:
- 'v*.*.*'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: desktop-cd-${{ github.ref }}
cancel-in-progress: true
jobs:
prepare:
name: 准备发布版本
runs-on: ubuntu-24.04
outputs:
app_version: ${{ steps.version.outputs.app_version }}
steps:
- name: 解析并校验版本号
id: version
shell: bash
run: |
set -Eeuo pipefail
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
if [[ ! "$GITHUB_REF_NAME" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
echo "版本标签必须符合 v1.2.3 格式:$GITHUB_REF_NAME" >&2
exit 1
fi
app_version="${GITHUB_REF_NAME#v}"
else
app_version="0.0.0-${GITHUB_RUN_NUMBER}"
fi
echo "app_version=$app_version" >> "$GITHUB_OUTPUT"
linux:
name: Linux 安装包 (${{ matrix.arch }})
needs: prepare
runs-on: ${{ matrix.runner }}
env:
APP_VERSION: ${{ needs.prepare.outputs.app_version }}
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-24.04
playwright_platform: ubuntu24.04-x64
- arch: arm64
runner: ubuntu-24.04-arm
playwright_platform: ubuntu24.04-arm64
steps:
- name: 检出代码
uses: actions/checkout@v6
- name: 配置 Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true
- name: 配置 Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: 构建嵌入式前端
run: npm ci --prefix frontend && npm run build --prefix frontend
- name: 编译 Linux 二进制
env:
GOOS: linux
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: 0
run: |
package_dir="dist/ydisks-xianyu-helper-linux-${GOARCH}"
mkdir -p "$package_dir"
go build -trimpath -ldflags='-s -w' -o "$package_dir/xianyu-server" ./cmd/server
go build -trimpath -ldflags='-s -w' -o "$package_dir/browser-install" ./cmd/browser-install
- name: 恢复 Linux Chromium runtime 缓存
id: cache-linux-playwright
uses: actions/cache/restore@v5
with:
path: dist/ydisks-xianyu-helper-linux-${{ matrix.arch }}/playwright-runtime
key: ydisks-playwright-runtime-v6-linux-${{ matrix.arch }}-${{ matrix.playwright_platform }}-${{ hashFiles('go.mod', 'go.sum', 'cmd/browser-install/**') }}
- name: 在原生架构 runner 预下载 Linux Chromium runtime
if: steps.cache-linux-playwright.outputs.cache-hit != 'true'
env:
GOARCH: ${{ matrix.arch }}
PLAYWRIGHT_HOST_PLATFORM_OVERRIDE: ${{ matrix.playwright_platform }}
run: |
set -Eeuo pipefail
case "$(uname -m)" in
x86_64) runner_arch=amd64 ;;
aarch64|arm64) runner_arch=arm64 ;;
*) echo "不支持的 runner 架构:$(uname -m)" >&2; exit 1 ;;
esac
if [ "$runner_arch" != "$GOARCH" ]; then
echo "runner 架构 $runner_arch 与目标架构 $GOARCH 不一致,拒绝使用模拟器构建。" >&2
exit 1
fi
package_dir="dist/ydisks-xianyu-helper-linux-${GOARCH}"
runtime_dir="$package_dir/playwright-runtime/$GOARCH"
mkdir -p "$runtime_dir/playwright-driver" "$runtime_dir/playwright-browsers"
"$package_dir/browser-install" \
-driver-dir "$PWD/$runtime_dir/playwright-driver" \
-browser-dir "$PWD/$runtime_dir/playwright-browsers"
- name: 校验 Linux Chromium runtime 架构
env:
GOARCH: ${{ matrix.arch }}
run: |
set -Eeuo pipefail
runtime_dir="dist/ydisks-xianyu-helper-linux-${GOARCH}/playwright-runtime/${GOARCH}"
node_path="$runtime_dir/playwright-driver/node"
test -x "$node_path"
"$node_path" --version
node_type="$(file -b "$node_path")"
case "$GOARCH:$node_type" in
amd64:*x86-64*) ;;
arm64:*aarch64*|arm64:*ARM64*) ;;
*) echo "Playwright driver 架构错误:$node_type" >&2; exit 1 ;;
esac
chromium_path="$(find "$runtime_dir/playwright-browsers" -type f \
\( -name chrome -o -name headless_shell -o -name chrome-headless-shell \) -perm -111 -print -quit)"
test -n "$chromium_path"
chromium_revision="$(RUNTIME_SPEC="$PWD/$runtime_dir/playwright-driver/package/browsers.json" node -e 'const b=require(process.env.RUNTIME_SPEC).browsers; console.log(b.find(x=>x.name==="chromium").revision)')"
headless_revision="$(RUNTIME_SPEC="$PWD/$runtime_dir/playwright-driver/package/browsers.json" node -e 'const b=require(process.env.RUNTIME_SPEC).browsers; console.log(b.find(x=>x.name==="chromium-headless-shell").revision)')"
test -d "$runtime_dir/playwright-browsers/chromium-$chromium_revision"
test -d "$runtime_dir/playwright-browsers/chromium_headless_shell-$headless_revision"
chromium_type="$(file -b "$chromium_path")"
case "$GOARCH:$chromium_type" in
amd64:*x86-64*) ;;
arm64:*aarch64*|arm64:*ARM64*) ;;
*) echo "Chromium 架构错误:$chromium_type" >&2; exit 1 ;;
esac
- name: 保存 Linux Chromium runtime 缓存
if: steps.cache-linux-playwright.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: dist/ydisks-xianyu-helper-linux-${{ matrix.arch }}/playwright-runtime
key: ${{ steps.cache-linux-playwright.outputs.cache-primary-key }}
- name: 组装 Linux 安装目录
run: |
set -Eeuo pipefail
package_dir="dist/ydisks-xianyu-helper-linux-${{ matrix.arch }}"
cp icon/linux/icon.png "$package_dir/icon.png"
cp packaging/linux/install.sh packaging/linux/uninstall.sh packaging/linux/ydisks-xianyu-helper.service "$package_dir/"
chmod +x "$package_dir/install.sh" "$package_dir/uninstall.sh"
tar -C dist -czf "dist/ydisks-xianyu-helper-linux-${{ matrix.arch }}-${APP_VERSION}.tar.gz" "$(basename "$package_dir")"
- name: 上传 Linux 安装包
uses: actions/upload-artifact@v7
with:
name: ydisks-xianyu-helper-linux-${{ matrix.arch }}-${{ env.APP_VERSION }}
path: dist/ydisks-xianyu-helper-linux-${{ matrix.arch }}-${{ env.APP_VERSION }}.tar.gz
if-no-files-found: error
windows:
name: Windows 安装包
needs: prepare
runs-on: windows-latest
env:
APP_VERSION: ${{ needs.prepare.outputs.app_version }}
steps:
- name: 检出代码
uses: actions/checkout@v6
- name: 配置 Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true
- name: 配置 Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: 构建嵌入式前端
shell: pwsh
run: npm ci --prefix frontend; npm run build --prefix frontend
- name: 验证 Windows 托盘逻辑与安装脚本
shell: pwsh
run: |
go test ./cmd/tray
$tokens = $null
$parseErrors = $null
[void][System.Management.Automation.Language.Parser]::ParseFile(
(Resolve-Path 'packaging/windows/service-control.ps1'),
[ref]$tokens,
[ref]$parseErrors
)
if ($parseErrors.Count -gt 0) {
$parseErrors | ForEach-Object { Write-Error $_.Message }
throw 'Windows 服务安装脚本语法检查失败'
}
- name: 编译 Windows 桌面程序
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path dist/windows | Out-Null
go build -trimpath -ldflags "-s -w" -o dist/windows/xianyu-server.exe ./cmd/server
go build -trimpath -ldflags "-s -w" -o dist/windows/browser-install.exe ./cmd/browser-install
go build -trimpath -ldflags "-s -w -H=windowsgui" -o dist/windows/xianyu-tray.exe ./cmd/tray
- name: 恢复 Windows Chromium runtime 缓存
id: cache-windows-playwright
uses: actions/cache/restore@v5
with:
path: dist/windows/playwright-runtime/amd64
key: ydisks-playwright-runtime-v6-windows-amd64-${{ hashFiles('go.mod', 'go.sum', 'cmd/browser-install/**') }}
- name: 预下载 Windows Chromium runtime
if: steps.cache-windows-playwright.outputs.cache-hit != 'true'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path dist/windows/playwright-runtime/amd64/playwright-driver | Out-Null
New-Item -ItemType Directory -Force -Path dist/windows/playwright-runtime/amd64/playwright-browsers | Out-Null
& dist/windows/browser-install.exe `
-driver-dir "$PWD/dist/windows/playwright-runtime/amd64/playwright-driver" `
-browser-dir "$PWD/dist/windows/playwright-runtime/amd64/playwright-browsers"
if ($LASTEXITCODE -ne 0) { throw 'Windows Playwright runtime 下载失败' }
- name: 校验 Windows Chromium runtime
shell: pwsh
run: |
$runtimeRoot = Resolve-Path 'dist/windows/playwright-runtime/amd64'
$driverNode = Join-Path $runtimeRoot 'playwright-driver/node.exe'
$driverCli = Join-Path $runtimeRoot 'playwright-driver/package/cli.js'
if (-not (Test-Path -LiteralPath $driverNode -PathType Leaf)) { throw 'Windows Playwright driver 缺少 node.exe' }
if (-not (Test-Path -LiteralPath $driverCli -PathType Leaf)) { throw 'Windows Playwright driver 缺少 package/cli.js' }
$browserSpec = Get-Content -Raw -LiteralPath (Join-Path $runtimeRoot 'playwright-driver/package/browsers.json') | ConvertFrom-Json
$chromiumRevision = ($browserSpec.browsers | Where-Object name -eq 'chromium').revision
$headlessRevision = ($browserSpec.browsers | Where-Object name -eq 'chromium-headless-shell').revision
if (-not (Test-Path -LiteralPath (Join-Path $runtimeRoot "playwright-browsers/chromium-$chromiumRevision") -PathType Container)) { throw 'Windows Chromium revision 与 driver 不匹配' }
if (-not (Test-Path -LiteralPath (Join-Path $runtimeRoot "playwright-browsers/chromium_headless_shell-$headlessRevision") -PathType Container)) { throw 'Windows headless shell revision 与 driver 不匹配' }
$chromium = Get-ChildItem -LiteralPath (Join-Path $runtimeRoot 'playwright-browsers') -Recurse -File |
Where-Object { $_.Name -in @('chrome.exe', 'headless_shell.exe', 'chrome-headless-shell.exe') } |
Select-Object -First 1
if ($null -eq $chromium) { throw 'Windows Chromium runtime 缺少 Chromium 可执行文件' }
- name: 保存 Windows Chromium runtime 缓存
if: steps.cache-windows-playwright.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: dist/windows/playwright-runtime/amd64
key: ${{ steps.cache-windows-playwright.outputs.cache-primary-key }}
- name: 导入 Windows 签名证书
shell: pwsh
env:
WINDOWS_SIGNING_PFX_BASE64: ${{ secrets.WINDOWS_SIGNING_PFX_BASE64 }}
WINDOWS_SIGNING_PFX_PASSWORD: ${{ secrets.WINDOWS_SIGNING_PFX_PASSWORD }}
WINDOWS_SIGNING_IDENTITY: ${{ secrets.WINDOWS_SIGNING_IDENTITY }}
run: |
$pfxPath = Join-Path $env:RUNNER_TEMP 'ydisks-windows-signing.pfx'
[IO.File]::WriteAllBytes($pfxPath, [Convert]::FromBase64String($env:WINDOWS_SIGNING_PFX_BASE64))
if (-not (Test-Path -LiteralPath $pfxPath -PathType Leaf)) { throw 'Windows PFX 文件写入失败' }
"WINDOWS_SIGNING_PFX_PATH=$pfxPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: 签名 Windows 桌面程序
shell: pwsh
env:
WINDOWS_SIGNING_PFX_PASSWORD: ${{ secrets.WINDOWS_SIGNING_PFX_PASSWORD }}
WINDOWS_SIGNING_IDENTITY: ${{ secrets.WINDOWS_SIGNING_IDENTITY }}
run: |
& packaging/windows/sign.ps1 `
-PfxPath $env:WINDOWS_SIGNING_PFX_PATH `
-Files 'dist/windows/xianyu-server.exe','dist/windows/xianyu-tray.exe'
- name: 安装 Inno Setup
shell: pwsh
run: choco install innosetup --no-progress --yes
- name: 构建 Windows 安装器
shell: pwsh
env:
APP_VERSION: ${{ env.APP_VERSION }}
run: |
& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' /Qp /O"dist\windows" packaging\windows\installer.iss
$installer = Get-ChildItem -Path dist/windows -Filter 'Ydisks-Xianyu-Helper-Setup.exe' -Recurse | Select-Object -First 1
if ($null -eq $installer) { throw 'Inno Setup 未生成安装器' }
$target = Join-Path (Resolve-Path dist/windows) 'Ydisks-Xianyu-Helper-Setup.exe'
if ($installer.FullName -ne $target) { Copy-Item $installer.FullName $target -Force }
- name: 签名 Windows 安装器
shell: pwsh
env:
WINDOWS_SIGNING_PFX_PASSWORD: ${{ secrets.WINDOWS_SIGNING_PFX_PASSWORD }}
WINDOWS_SIGNING_IDENTITY: ${{ secrets.WINDOWS_SIGNING_IDENTITY }}
run: |
& packaging/windows/sign.ps1 `
-PfxPath $env:WINDOWS_SIGNING_PFX_PATH `
-Files 'dist/windows/Ydisks-Xianyu-Helper-Setup.exe'
- name: 打包 Windows 二进制归档
shell: pwsh
env:
APP_VERSION: ${{ env.APP_VERSION }}
run: |
Compress-Archive -Path dist/windows/xianyu-server.exe,dist/windows/xianyu-tray.exe,dist/windows/playwright-runtime -DestinationPath "dist/windows/Ydisks-Xianyu-Helper-${env:APP_VERSION}-binaries.zip"
- name: 上传 Windows 安装包
uses: actions/upload-artifact@v7
with:
name: ydisks-xianyu-helper-windows-${{ env.APP_VERSION }}
path: |
dist/windows/Ydisks-Xianyu-Helper-Setup.exe
dist/windows/Ydisks-Xianyu-Helper-${{ env.APP_VERSION }}-binaries.zip
if-no-files-found: error
macos:
name: macOS 安装包
needs: prepare
runs-on: macos-14
env:
APP_VERSION: ${{ needs.prepare.outputs.app_version }}
steps:
- name: 检出代码
uses: actions/checkout@v6
- name: 配置 Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true
- name: 配置 Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: 构建嵌入式前端
run: npm ci --prefix frontend && npm run build --prefix frontend
- name: 验证 macOS 托盘逻辑
run: go test ./cmd/tray
- name: 编译 macOS 桌面程序
run: |
mkdir -p dist/macos/arm64 dist/macos/amd64
for arch in arm64 amd64; do
GOOS=darwin GOARCH="$arch" CGO_ENABLED=1 go build -trimpath -ldflags='-s -w' -o "dist/macos/$arch/xianyu-server" ./cmd/server
GOOS=darwin GOARCH="$arch" CGO_ENABLED=1 go build -trimpath -ldflags='-s -w' -o "dist/macos/$arch/browser-install" ./cmd/browser-install
GOOS=darwin GOARCH="$arch" CGO_ENABLED=1 go build -trimpath -ldflags='-s -w' -o "dist/macos/$arch/xianyu-tray" ./cmd/tray
done
- name: 缓存 macOS Chromium runtime
id: cache-macos-playwright
uses: actions/cache/restore@v5
with:
path: |
dist/macos/playwright-runtime/arm64
dist/macos/playwright-runtime/amd64
key: ydisks-playwright-runtime-v6-macos-mac14-universal-${{ hashFiles('go.mod', 'go.sum', 'cmd/browser-install/**') }}
- name: 预下载 macOS Chromium runtime
if: steps.cache-macos-playwright.outputs.cache-hit != 'true'
run: |
set -Eeuo pipefail
mkdir -p dist/macos/playwright-runtime/arm64/playwright-driver
mkdir -p dist/macos/playwright-runtime/arm64/playwright-browsers
mkdir -p dist/macos/playwright-runtime/amd64/playwright-driver
mkdir -p dist/macos/playwright-runtime/amd64/playwright-browsers
PLAYWRIGHT_HOST_PLATFORM_OVERRIDE=mac14-arm64 \
dist/macos/arm64/browser-install \
-driver-dir "$PWD/dist/macos/playwright-runtime/arm64/playwright-driver" \
-browser-dir "$PWD/dist/macos/playwright-runtime/arm64/playwright-browsers"
PLAYWRIGHT_HOST_PLATFORM_OVERRIDE=mac14 \
arch -x86_64 dist/macos/amd64/browser-install \
-driver-dir "$PWD/dist/macos/playwright-runtime/amd64/playwright-driver" \
-browser-dir "$PWD/dist/macos/playwright-runtime/amd64/playwright-browsers"
- name: 校验 macOS Chromium runtime
run: |
set -Eeuo pipefail
for runtime_arch in arm64 amd64; do
runtime_dir="dist/macos/playwright-runtime/$runtime_arch"
node_path="$runtime_dir/playwright-driver/node"
spec_path="$PWD/$runtime_dir/playwright-driver/package/browsers.json"
test -x "$node_path"
test -f "$runtime_dir/playwright-driver/package/cli.js"
test -f "$spec_path"
chromium_revision="$(RUNTIME_SPEC="$spec_path" node -e 'const b=require(process.env.RUNTIME_SPEC).browsers; console.log(b.find(x=>x.name==="chromium").revision)')"
headless_revision="$(RUNTIME_SPEC="$spec_path" node -e 'const b=require(process.env.RUNTIME_SPEC).browsers; console.log(b.find(x=>x.name==="chromium-headless-shell").revision)')"
test -d "$runtime_dir/playwright-browsers/chromium-$chromium_revision"
test -d "$runtime_dir/playwright-browsers/chromium_headless_shell-$headless_revision"
chromium_path="$(find "$runtime_dir/playwright-browsers/chromium-$chromium_revision" -type f -path '*/Contents/MacOS/Google Chrome for Testing' -print -quit)"
headless_path="$(find "$runtime_dir/playwright-browsers/chromium_headless_shell-$headless_revision" -type f -name chrome-headless-shell -print -quit)"
test -n "$chromium_path"
test -n "$headless_path"
node_type="$(file -b "$node_path")"
chromium_type="$(file -b "$chromium_path")"
headless_type="$(file -b "$headless_path")"
case "$runtime_arch:$node_type:$chromium_type:$headless_type" in
arm64:*arm64*:*arm64*:*arm64*) ;;
amd64:*x86_64*:*x86_64*:*x86_64*) ;;
*) echo "macOS Playwright runtime 架构错误:$runtime_arch / $node_type / $chromium_type / $headless_type" >&2; exit 1 ;;
esac
done
- name: 保存 macOS Chromium runtime 缓存
if: steps.cache-macos-playwright.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: |
dist/macos/playwright-runtime/arm64
dist/macos/playwright-runtime/amd64
key: ${{ steps.cache-macos-playwright.outputs.cache-primary-key }}
- name: 导入 macOS 签名证书
env:
MACOS_SIGNING_P12_BASE64: ${{ secrets.MACOS_SIGNING_P12_BASE64 }}
MACOS_INSTALLER_SIGNING_P12_BASE64: ${{ secrets.MACOS_INSTALLER_SIGNING_P12_BASE64 }}
MACOS_SIGNING_P12_PASSWORD: ${{ secrets.MACOS_SIGNING_P12_PASSWORD }}
MACOS_SIGNING_IDENTITY: ${{ secrets.MACOS_SIGNING_IDENTITY }}
MACOS_INSTALLER_SIGNING_IDENTITY: ${{ secrets.MACOS_INSTALLER_SIGNING_IDENTITY }}
run: |
set -Eeuo pipefail
keychain_path="$RUNNER_TEMP/ydisks-signing.keychain-db"
keychain_password="$(uuidgen)"
app_p12_path="$RUNNER_TEMP/ydisks-signing-app.p12"
app_cert_path="$RUNNER_TEMP/ydisks-signing-app.pem"
installer_p12_path="$RUNNER_TEMP/ydisks-signing-installer.p12"
installer_cert_path="$RUNNER_TEMP/ydisks-signing-installer.pem"
printf '%s' "$MACOS_SIGNING_P12_BASE64" | base64 --decode > "$app_p12_path"
printf '%s' "$MACOS_INSTALLER_SIGNING_P12_BASE64" | base64 --decode > "$installer_p12_path"
security create-keychain -p "$keychain_password" "$keychain_path"
security set-keychain-settings -lut 21600 "$keychain_path"
security unlock-keychain -p "$keychain_password" "$keychain_path"
# 临时 CI 钥匙串使用 -A 授权签名工具,避免 set-key-partition-list 触发交互确认。
security import "$app_p12_path" -k "$keychain_path" -P "$MACOS_SIGNING_P12_PASSWORD" -A
security import "$installer_p12_path" -k "$keychain_path" -P "$MACOS_SIGNING_P12_PASSWORD" -A
security find-certificate -c "$MACOS_SIGNING_IDENTITY" -p "$keychain_path" > "$app_cert_path"
security find-certificate -c "$MACOS_INSTALLER_SIGNING_IDENTITY" -p "$keychain_path" > "$installer_cert_path"
# GitHub macOS hosted runner 提供免密码 sudo;只修改 admin Trust Settings,避免弹认证对话框。
# 不传 -k,避免 sudo 以 root 身份把同一张证书重复写入临时钥匙串,破坏私钥匹配。
sudo -n security add-trusted-cert -d -r trustRoot -p codeSign "$app_cert_path"
sudo -n security add-trusted-cert -d -r trustRoot -p basic "$installer_cert_path"
security list-keychains -d user -s "$keychain_path"
security unlock-keychain -p "$keychain_password" "$keychain_path"
echo "MACOS_SIGNING_KEYCHAIN=$keychain_path" >> "$GITHUB_ENV"
- name: 构建 macOS arm64 与 amd64 安装包
env:
MACOS_SIGNING_IDENTITY: ${{ secrets.MACOS_SIGNING_IDENTITY }}
MACOS_INSTALLER_SIGNING_IDENTITY: ${{ secrets.MACOS_INSTALLER_SIGNING_IDENTITY }}
run: |
set -Eeuo pipefail
chmod +x packaging/macos/build-pkg.sh
for arch in arm64 amd64; do
packaging/macos/build-pkg.sh "$APP_VERSION" "$PWD/dist/macos" "$arch"
done
- name: 上传 macOS arm64 安装包
uses: actions/upload-artifact@v7
with:
name: ydisks-xianyu-helper-macos-arm64-${{ env.APP_VERSION }}
path: dist/macos/Ydisks-Xianyu-Helper-${{ env.APP_VERSION }}-arm64.pkg
if-no-files-found: error
- name: 上传 macOS amd64 安装包
uses: actions/upload-artifact@v7
with:
name: ydisks-xianyu-helper-macos-amd64-${{ env.APP_VERSION }}
path: dist/macos/Ydisks-Xianyu-Helper-${{ env.APP_VERSION }}-amd64.pkg
if-no-files-found: error
release:
name: 发布 GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
needs:
- prepare
- linux
- windows
- macos
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: 下载全部平台安装包
uses: actions/download-artifact@v8
with:
pattern: ydisks-xianyu-helper-*
path: dist/release
merge-multiple: true
- name: 校验 Release 文件
shell: bash
run: |
set -Eeuo pipefail
test -f "dist/release/ydisks-xianyu-helper-linux-amd64-${{ needs.prepare.outputs.app_version }}.tar.gz"
test -f "dist/release/ydisks-xianyu-helper-linux-arm64-${{ needs.prepare.outputs.app_version }}.tar.gz"
test -f "dist/release/Ydisks-Xianyu-Helper-Setup.exe"
test -f "dist/release/Ydisks-Xianyu-Helper-${{ needs.prepare.outputs.app_version }}-binaries.zip"
test -f "dist/release/Ydisks-Xianyu-Helper-${{ needs.prepare.outputs.app_version }}-arm64.pkg"
test -f "dist/release/Ydisks-Xianyu-Helper-${{ needs.prepare.outputs.app_version }}-amd64.pkg"
(
cd dist/release
sha256sum * > SHA256SUMS
)
- name: 创建或更新 GitHub Release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
RELEASE_VERSION: ${{ needs.prepare.outputs.app_version }}
run: |
set -Eeuo pipefail
mapfile -t release_files < <(find dist/release -maxdepth 1 -type f -print | sort)
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
gh release upload "$GITHUB_REF_NAME" "${release_files[@]}" --clobber
else
gh release create "$GITHUB_REF_NAME" "${release_files[@]}" \
--verify-tag \
--generate-notes \
--title "Ydisks 闲鱼助手 $RELEASE_VERSION"
fi