ghostty/.github/workflows/release-tip.yml
2022-11-17 12:15:23 -08:00

67 lines
2.0 KiB
YAML

on:
workflow_run:
workflows: [Test]
types: [completed]
branches: [main]
workflow_dispatch: {}
name: Release Tip
jobs:
build-macos:
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
env:
# Needed for macos SDK
AGREE: "true"
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
# Install Nix and use that so our environment matches exactly.
- uses: cachix/install-nix-action@v18
with:
nix_path: nixpkgs=channel:nixos-unstable
# Cross-compile the binary. We always use static building for this
# because its the only way to access the headers.
- name: Build aarch64
run: |
nix develop -c zig build -Dcpu=baseline -Dstatic=true -Dtarget=aarch64-macos -Drelease-fast
mv zig-out/bin/ghostty zig-out/bin/ghostty-aarch64-macos
- name: Build x86_64
run: |
nix develop -c zig build -Dcpu=baseline -Dstatic=true -Dtarget=x86_64-macos -Drelease-fast
mv zig-out/bin/ghostty zig-out/bin/ghostty-x86_64-macos
- name: Create Universal Binary
run: |
# Lipo our binaries
nix develop -c \
llvm-lipo \
zig-out/bin/ghostty-aarch64-macos \
zig-out/bin/ghostty-x86_64-macos \
-create \
-output zig-out/bin/ghostty-universal
# Ensure the app is universal
cp zig-out/bin/ghostty-universal zig-out/Ghostty.app/Contents/MacOS/ghostty
# Zip up the app
- name: Zip App
run: nix develop -c sh -c 'cd zig-out && zip -9 -r ../ghostty-macos-universal.zip Ghostty.app'
# Update Release
- name: Release
uses: softprops/action-gh-release@v1
with:
name: "Ghostty Tip (\"Nightly\")"
prerelease: true
tag_name: tip
target_commitish: ${{ github.sha }}
files: ghostty-macos-universal.zip