Jordan Bentley 5bb9853523
fix build for intel macs
💎 Built using [Crystal](https://github.com/stravu/crystal)

Co-Authored-By: Crystal <crystal@stravu.com>
2025-10-11 12:43:09 -04:00

135 lines
4.5 KiB
YAML

name: Build and Publish Canary
on:
push:
branches: [ main, 'release/**' ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build:
strategy:
matrix:
# Build both platforms for validation, but use different commands for speed
os: [macos-latest, ubuntu-latest]
include:
- os: macos-latest
build_cmd: build:mac:universal
artifact_name: crystal-macos-canary
artifact_path: |
dist-electron/*.dmg
dist-electron/*.zip
dist-electron/latest-mac.yml
- os: ubuntu-latest
build_cmd: canary:linux
artifact_name: crystal-linux-canary
artifact_path: |
dist-electron/*.deb
dist-electron/*.AppImage
dist-electron/latest-linux.yml
runs-on: ${{ matrix.os }}
permissions:
contents: write # Required for creating releases and accessing repository contents
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.15.1'
cache: 'pnpm'
# Cache electron binaries to speed up builds
- name: Cache Electron binaries
uses: actions/cache@v4
with:
path: |
~/.cache/electron
~/.cache/electron-builder
~/AppData/Local/electron/Cache
~/AppData/Local/electron-builder/Cache
key: ${{ runner.os }}-electron-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-electron-
# Cache built frontend and main process to avoid rebuilds
- name: Cache built components
uses: actions/cache@v4
with:
path: |
frontend/dist
main/dist
key: ${{ runner.os }}-build-${{ hashFiles('frontend/**', 'main/**', '**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-
- name: Install dependencies
run: pnpm install
# Build frontend and main process in parallel for faster builds (skip if cached)
- name: Build frontend and main process
run: |
# Check if builds exist from cache
if [ ! -d "frontend/dist" ] || [ ! -d "main/dist" ]; then
echo "Building frontend and main process..."
# Build both frontend and main process concurrently
pnpm run build:frontend &
pnpm run build:main &
wait
else
echo "Using cached frontend and main builds"
fi
- name: Generate NOTICES file
run: pnpm run generate-notices
- name: Build and publish canary release
run: pnpm run ${{ matrix.build_cmd }}
env:
# GitHub token (required by electron-builder for publishing)
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Mark this as a canary build
CANARY_BUILD: true
# macOS code signing (optional for CI builds)
CSC_LINK: ${{ matrix.os == 'macos-latest' && secrets.APPLE_CERTIFICATE || '' }}
CSC_KEY_PASSWORD: ${{ matrix.os == 'macos-latest' && secrets.APPLE_CERTIFICATE_PASSWORD || '' }}
# macOS notarization (optional for CI builds)
APPLE_ID: ${{ matrix.os == 'macos-latest' && secrets.APPLE_ID || '' }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ matrix.os == 'macos-latest' && secrets.APPLE_APP_PASSWORD || '' }}
APPLE_TEAM_ID: ${{ matrix.os == 'macos-latest' && secrets.APPLE_TEAM_ID || '' }}
# Only enable signing when certificates are available
CSC_IDENTITY_AUTO_DISCOVERY: ${{ matrix.os == 'macos-latest' && 'true' || 'false' }}
# Disable signing entirely when no certificates are present
CSC_DISABLE: ${{ (matrix.os == 'macos-latest' && !secrets.APPLE_CERTIFICATE) && 'true' || 'false' }}
- name: List build artifacts
run: ls -la dist-electron/
# Skip Flatpak build for CI speed - saves 4+ minutes
# Flatpak is built separately in release workflow
- name: Skip Flatpak build (CI optimization)
if: matrix.os == 'ubuntu-latest'
run: echo "Skipping Flatpak build for faster CI - will be built in release workflow"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_path }}
if-no-files-found: error
retention-days: 30