cmux/.github/workflows/build-ghosttykit.yml
Lawrence Chen 9d00ae9ab0
Move Build GhosttyKit to Depot to avoid self-hosted concurrency cancellations (#713)
build-ghosttykit shared the self-hosted-build concurrency group with
CI tests, causing one to get cancelled when both trigger on the same
push. Most runs are no-ops (xcframework already exists), so Depot is
a good fit. Eliminates the red X on pushes to main.
2026-02-28 22:46:15 -08:00

94 lines
3.4 KiB
YAML

name: Build GhosttyKit
on:
push:
branches:
- main
pull_request:
jobs:
build-ghosttykit:
# Never run Depot jobs for fork pull requests (avoid billing on external PRs).
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: depot-macos-latest
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
submodules: recursive
- name: Get ghostty SHA
id: ghostty-sha
run: |
SHA=$(git -C ghostty rev-parse HEAD)
echo "sha=$SHA" >> "$GITHUB_OUTPUT"
echo "Ghostty SHA: $SHA"
- name: Check if xcframework release already exists
id: check-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="xcframework-${{ steps.ghostty-sha.outputs.sha }}"
if gh release view "$TAG" --repo manaflow-ai/ghostty >/dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "Release $TAG already exists, skipping build"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
echo "Release $TAG not found, will build"
fi
- name: Select Xcode
if: steps.check-release.outputs.exists == 'false'
run: |
set -euo pipefail
if [ -d "/Applications/Xcode.app/Contents/Developer" ]; then
XCODE_DIR="/Applications/Xcode.app/Contents/Developer"
else
XCODE_APP="$(ls -d /Applications/Xcode*.app 2>/dev/null | head -n 1 || true)"
if [ -n "$XCODE_APP" ]; then
XCODE_DIR="$XCODE_APP/Contents/Developer"
else
echo "No Xcode.app found under /Applications" >&2
exit 1
fi
fi
echo "DEVELOPER_DIR=$XCODE_DIR" >> "$GITHUB_ENV"
export DEVELOPER_DIR="$XCODE_DIR"
xcodebuild -version
- name: Build GhosttyKit.xcframework
if: steps.check-release.outputs.exists == 'false'
run: |
set -euo pipefail
if ! command -v zig >/dev/null 2>&1; then
if command -v brew >/dev/null 2>&1; then
brew install zig
else
echo "zig is required to build GhosttyKit.xcframework. Install zig and retry." >&2
exit 1
fi
fi
cd ghostty && zig build -Demit-xcframework=true -Demit-macos-app=false -Doptimize=ReleaseFast
- name: Package xcframework
if: steps.check-release.outputs.exists == 'false'
run: |
set -euo pipefail
rm -rf GhosttyKit.xcframework
cp -R ghostty/macos/GhosttyKit.xcframework GhosttyKit.xcframework
tar czf GhosttyKit.xcframework.tar.gz GhosttyKit.xcframework
- name: Upload xcframework release
if: steps.check-release.outputs.exists == 'false'
env:
GH_TOKEN: ${{ secrets.GHOSTTY_RELEASE_TOKEN }}
run: |
set -euo pipefail
TAG="xcframework-${{ steps.ghostty-sha.outputs.sha }}"
gh release create "$TAG" \
--repo manaflow-ai/ghostty \
--title "GhosttyKit xcframework (${{ steps.ghostty-sha.outputs.sha }})" \
--notes "Pre-built GhosttyKit.xcframework for commit ${{ steps.ghostty-sha.outputs.sha }}" \
GhosttyKit.xcframework.tar.gz
echo "Published release $TAG"