mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-05-11 23:39:44 +08:00
- CI 工作流统一启用 Node24 JavaScript 运行时,消除 Node20 退役告警干扰 - macOS 打包阶段为 UPX 增加 --force-macos,修复 Mach-O 压缩失败 - Windows 打包按架构分流:arm64 跳过 UPX 并保留原始 EXE,amd64 继续强制压缩 - Windows 压缩流程新增 $LASTEXITCODE 显式校验,避免命令失败被误判为成功 - 本地 build-release.sh 同步 macOS/Windows 的 UPX 兼容策略与错误处理逻辑
95 lines
2.6 KiB
YAML
95 lines
2.6 KiB
YAML
name: Test Build macOS (Manual)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
build_label:
|
|
description: "测试包标识(仅用于文件名)"
|
|
required: false
|
|
default: "test"
|
|
push:
|
|
branches:
|
|
- feature/kingbase_opt
|
|
paths:
|
|
- ".github/workflows/test-macos-build.yml"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
|
|
|
jobs:
|
|
build-macos:
|
|
name: Build macOS ${{ matrix.arch }}
|
|
runs-on: macos-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- platform: darwin/amd64
|
|
arch: amd64
|
|
- platform: darwin/arm64
|
|
arch: arm64
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.24.3"
|
|
check-latest: true
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
|
|
- name: Install Wails
|
|
run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.11.0
|
|
|
|
- name: Build App
|
|
run: |
|
|
set -euo pipefail
|
|
OUTPUT_NAME="gonavi-test-${{ matrix.arch }}"
|
|
BUILD_LABEL="${{ inputs.build_label }}"
|
|
if [ -z "$BUILD_LABEL" ]; then
|
|
BUILD_LABEL="test"
|
|
fi
|
|
APP_VERSION="${BUILD_LABEL}-${GITHUB_RUN_NUMBER}"
|
|
wails build \
|
|
-platform "${{ matrix.platform }}" \
|
|
-clean \
|
|
-o "$OUTPUT_NAME" \
|
|
-ldflags "-s -w -X GoNavi-Wails/internal/app.AppVersion=${APP_VERSION}"
|
|
|
|
- name: Package Zip
|
|
run: |
|
|
set -euo pipefail
|
|
APP_PATH="build/bin/gonavi-test-${{ matrix.arch }}.app"
|
|
if [ ! -d "$APP_PATH" ]; then
|
|
APP_PATH=$(find build/bin -maxdepth 1 -name "*.app" | head -n 1 || true)
|
|
fi
|
|
if [ -z "$APP_PATH" ] || [ ! -d "$APP_PATH" ]; then
|
|
echo "未找到 .app 产物"
|
|
ls -la build/bin || true
|
|
exit 1
|
|
fi
|
|
LABEL="${{ inputs.build_label }}"
|
|
if [ -z "$LABEL" ]; then
|
|
LABEL="test"
|
|
fi
|
|
ZIP_NAME="GoNavi-${LABEL}-macos-${{ matrix.arch }}-run${GITHUB_RUN_NUMBER}.zip"
|
|
mkdir -p artifacts
|
|
ditto -c -k --sequesterRsrc --keepParent "$APP_PATH" "artifacts/$ZIP_NAME"
|
|
shasum -a 256 "artifacts/$ZIP_NAME" > "artifacts/$ZIP_NAME.sha256"
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: gonavi-macos-${{ matrix.arch }}-run${{ github.run_number }}
|
|
path: artifacts/*
|
|
if-no-files-found: error
|