Files
ICCery/.github/workflows/build-macos.yml

129 lines
4.1 KiB
YAML

name: Build macOS Packages
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build-macos:
name: Build macOS (${{ matrix.platform.name }})
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform:
- name: Intel
os: macos-26-intel
target: x86_64-apple-darwin
binary_dir: macos-x86_64
arch: x86_64
- name: Apple Silicon
os: macos-latest
target: aarch64-apple-darwin
binary_dir: macos-aarch64
arch: arm64
- name: Universal (Intel + Apple Silicon)
os: macos-latest
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: 20
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: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install Node dependencies
run: npm ci
- name: Fetch ArgyllCMS binaries
env:
ARGYLL_RELEASE_TAG: ${{ vars.ARGYLL_RELEASE_TAG }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run fetch-argyll -- --force --platform ${{ matrix.platform.binary_dir }}
- 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
if: runner.os == 'macOS'
run: |
# Tauri's DMG bundler runs an AppleScript that asks Finder to set the
# background picture and icon positions. On CI runners, Finder or the
# Aqua session may be idle, which can cause AppleEvent timeouts. Try to
# start/awaken Finder and System Events before the real build.
open -g -a Finder || true
open -g -a "System Events" || true
# Send a harmless probe to force Finder to initialise a scripting session.
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@v4
with:
name: ${{ env.PREFIX }}
path: release-assets/*
- name: Release on GitHub
uses: softprops/action-gh-release@v2
with:
files: release-assets/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}