Files
vgearen d8904f4acb fix(ui): match settings height to list mode + CI uses latest Xcode
UI fix (SDK-agnostic):
- SettingsView height 480 → 620 so the settings mode panel size matches
  list mode at maximum. Avoids MenuBarExtra's NSPanel not shrinking when
  switching between list and settings views.
- Drop the .id(showSettings) hack — it forced view rebuild but the panel
  is managed by AppKit and does not respond to SwiftUI view recreation.

CI hardening:
- Use maxim-lobanov/setup-xcode@v1 with latest-stable so the runner Xcode
  is as close to local (Xcode 26.5) as available, minimizing SwiftUI SDK
  behavior drift.
- Run xcodebuild test before building the DMG; release will fail-fast on
  test regressions instead of shipping broken binaries.

Root cause analysis of v1.3.4 regression:
Local Xcode 26.5 produced a 5.2MB binary linking to macOS 26 SwiftUI
symbols; GH macos-latest with default Xcode 16 produced a 5.0MB binary
linking to macOS 15 SwiftUI. The .id() hack happened to look correct in
the SDK 26 build but not in SDK 15 — same source, different runtime
behavior. The height:620 approach works in both.
2026-05-14 11:30:52 +08:00

89 lines
2.5 KiB
YAML

name: Release Stockbar DMG
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
# runs-on 取最新可用,setup-xcode 选 latest-stable,尽量接近本地 SDK。
# SwiftUI(特别是 MenuBarExtra panel)在不同 SDK 下行为不一致 ——
# CI 用旧 SDK 编译会导致用户实际使用时 UI 异常(如 v1.3.4 设置页空白)。
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Xcode (latest-stable)
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Show toolchain
run: |
xcodebuild -version
xcodebuild -showsdks | grep -i macos | head -5
- name: Run Tests
run: |
xcodebuild test \
-project StockMonitor.xcodeproj \
-scheme Stockbar \
-destination 'platform=macOS,arch=arm64' \
CODE_SIGN_IDENTITY="-" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO
- name: Build Universal Binary
run: |
MARKETING_VERSION="${GITHUB_REF_NAME#v}"
xcodebuild \
-project StockMonitor.xcodeproj \
-scheme Stockbar \
-configuration Release \
-derivedDataPath build \
ARCHS="arm64 x86_64" \
ONLY_ACTIVE_ARCH=NO \
CODE_SIGN_IDENTITY="-" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO \
MARKETING_VERSION="${MARKETING_VERSION}"
- name: Locate .app
id: locate
run: |
APP_PATH=$(find build -name "Stockbar.app" -maxdepth 6 | head -1)
echo "app_path=$APP_PATH" >> "$GITHUB_OUTPUT"
- name: Create DMG
run: |
APP_PATH="${{ steps.locate.outputs.app_path }}"
VERSION="${GITHUB_REF_NAME}"
DMG_NAME="Stockbar-${VERSION}.dmg"
mkdir -p dmg_staging
cp -R "$APP_PATH" dmg_staging/
ln -s /Applications dmg_staging/Applications
hdiutil create \
-volname "Stockbar ${VERSION}" \
-srcfolder dmg_staging \
-ov \
-format UDZO \
"$DMG_NAME"
echo "DMG created: $DMG_NAME"
- name: Upload Release
uses: softprops/action-gh-release@v2
with:
files: Stockbar-*.dmg
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}