Skip to content

chore(mac): use NSLog instead of print for unified logging #56

chore(mac): use NSLog instead of print for unified logging

chore(mac): use NSLog instead of print for unified logging #56

Workflow file for this run

name: Build macOS App
on:
push:
branches: [ "main", "master" ]
paths:
- 'Mac/**'
- '.github/workflows/build-mac.yml'
workflow_dispatch: # 允许手动触发打包
jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pillow
- name: Generate App Icon
working-directory: ./Mac
run: |
python -c "from PIL import Image; Image.open('../Windows/Assets/CarpeCast-logo.png').resize((512,512)).save('AppIcon.icns')"
- name: Build Native Swift App
working-directory: ./Mac
run: |
chmod +x build.sh
./build.sh
cp AppIcon.icns build/CarpeCast.app/Contents/Resources/
- name: Package App
working-directory: ./Mac
run: |
# 提取版本号和 Hash
VERSION=$(grep -oE '<key>CFBundleShortVersionString</key>[[:space:]]*<string>[^<]+</string>' CarpeCast-Swift/Info.plist | grep -oE '<string>[^<]+</string>' | sed -e 's/<string>//' -e 's/<\/string>//' | head -1)
if [ -z "$VERSION" ]; then VERSION="1.0"; fi
HASH=$(git rev-parse --short HEAD)
# 压缩 .app 以防 GitHub Actions 上传时吞掉顶层目录,文件名加上版本号和 Hash
cd build
ZIP_NAME="CarpeCast-Mac-v${VERSION}-${HASH}.zip"
zip -ry "$ZIP_NAME" CarpeCast.app
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: CarpeCast-Mac
path: Mac/build/CarpeCast-Mac-*.zip