147 lines
5.2 KiB
YAML
147 lines
5.2 KiB
YAML
name: Build macOS Packages
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build-macos:
|
|
name: Build macOS (${{ matrix.platform.name }})
|
|
runs-on: ${{ matrix.platform.os }}
|
|
env:
|
|
XDG_CONFIG_HOME: ${{ runner.temp }}/.config
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- name: Intel
|
|
os: macos
|
|
target: x86_64-apple-darwin
|
|
binary_dir: macos-x86_64
|
|
arch: x86_64
|
|
# - name: Apple Silicon
|
|
# os: macos
|
|
# target: aarch64-apple-darwin
|
|
# binary_dir: macos-aarch64
|
|
# arch: arm64
|
|
# - name: Universal (Intel + Apple Silicon)
|
|
# os: macos
|
|
# target: universal-apple-darwin
|
|
# binary_dir: macos-universal
|
|
# arch: universal
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Ensure workspace and git permissions
|
|
run: |
|
|
mkdir -p "${{ runner.temp }}/.config/git"
|
|
touch "${{ runner.temp }}/.config/git/ignore"
|
|
mkdir -p .git/info
|
|
touch .git/info/exclude
|
|
chmod -R u+rwX .git || true
|
|
chmod 644 .git/info/exclude || true
|
|
git config --local core.excludesFile "${{ runner.temp }}/.config/git/ignore" || true
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24
|
|
cache: 'npm'
|
|
|
|
- name: Install Rust stable
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
toolchain: stable
|
|
targets: ${{ matrix.platform.target == 'universal-apple-darwin' && 'x86_64-apple-darwin, aarch64-apple-darwin' || matrix.platform.target }}
|
|
|
|
- name: Install Node dependencies
|
|
run: npm ci
|
|
|
|
- name: Fetch ArgyllCMS binaries
|
|
env:
|
|
ARGYLL_SERVER_URL: ${{ github.server_url }}
|
|
ARGYLL_RELEASE_TAG: ${{ vars.ARGYLL_RELEASE_TAG }}
|
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: npm run fetch-argyll -- --force --platform ${{ matrix.platform.binary_dir }} --server "${{ github.server_url }}"
|
|
|
|
- name: Verify sidecar binaries
|
|
run: |
|
|
test -x "src-tauri/argyll/${{ matrix.platform.binary_dir }}/instlist"
|
|
test -x "src-tauri/argyll/${{ matrix.platform.binary_dir }}/targen"
|
|
|
|
- name: Set Release Environment
|
|
id: set_env
|
|
shell: bash
|
|
run: |
|
|
TAG="${{ github.ref_name }}"
|
|
SHORT_SHA=$(git rev-parse --short HEAD)
|
|
echo "TAG=${TAG}" >> $GITHUB_ENV
|
|
echo "SHORT_SHA=${SHORT_SHA}" >> $GITHUB_ENV
|
|
echo "PREFIX=ICCery_${TAG}-${SHORT_SHA}-macos-${{ matrix.platform.arch }}" >> $GITHUB_ENV
|
|
|
|
- name: Warm up macOS GUI for DMG layout
|
|
shell: bash
|
|
run: |
|
|
# Tauri's DMG bundler runs Finder AppleScript to set the background
|
|
# picture and icon positions. On CI Macs, Finder/Aqua may be idle,
|
|
# which causes AppleEvent timeouts (-1712). Wake them before build.
|
|
echo "WindowServer: $(pgrep -l WindowServer || echo 'NOT RUNNING')"
|
|
echo "console user: $(stat -f '%Su' /dev/console 2>/dev/null || echo unknown)"
|
|
echo "whoami: $(whoami)"
|
|
open -g -a Finder || true
|
|
open -g -a "System Events" || true
|
|
osascript -e 'tell application "Finder" to get name' || true
|
|
sleep 10
|
|
|
|
- name: Build Tauri App
|
|
env:
|
|
TAURI_BUNDLER_DMG_IGNORE_CI: "true"
|
|
run: npm run tauri build -- --target ${{ matrix.platform.target }}
|
|
|
|
- name: Prepare Release Assets
|
|
shell: bash
|
|
run: |
|
|
mkdir -p release-assets
|
|
|
|
# Stage DMG package
|
|
DMG_FILE=$(find src-tauri/target -type f -path "*/release/bundle/dmg/*.dmg" | head -n 1)
|
|
if [ -n "$DMG_FILE" ] && [ -f "$DMG_FILE" ]; then
|
|
cp "$DMG_FILE" "release-assets/${PREFIX}.dmg"
|
|
fi
|
|
|
|
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ env.PREFIX }}
|
|
path: release-assets/*
|
|
|
|
- name: Upload Release Assets to Gitea
|
|
if: !cancelled()
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SERVER_URL: ${{ github.server_url }}
|
|
REPO: ${{ github.repository }}
|
|
run: |
|
|
echo "Finding release for tag ${TAG}..."
|
|
RELEASE_RESP=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" "${SERVER_URL}/api/v1/repos/${REPO}/releases/tags/${TAG}")
|
|
RELEASE_ID=$(echo "${RELEASE_RESP}" | grep -o '"id":[0-9]*' | head -n 1 | cut -d: -f2)
|
|
if [ -n "${RELEASE_ID}" ]; then
|
|
echo "Found Release ID: ${RELEASE_ID}. Uploading macOS assets..."
|
|
for f in release-assets/*; do
|
|
if [ -f "$f" ]; then
|
|
FILENAME=$(basename "$f")
|
|
echo "Uploading $FILENAME to release ${RELEASE_ID}..."
|
|
curl -s -X POST \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-H "Content-Type: multipart/form-data" \
|
|
-F "attachment=@$f" \
|
|
"${SERVER_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${FILENAME}"
|
|
fi
|
|
done
|
|
else
|
|
echo "No existing release found for tag ${TAG}. Skipping asset upload."
|
|
fi
|