From 2d3126ffb79f35110c11e8847b90f0ded7e287d7 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 17 Nov 2022 11:24:12 -0800 Subject: [PATCH] release-tip workflow (wip) --- .github/workflows/release-tip.yml | 64 +++++++++++++++++++++++++++++++ nix/devshell.nix | 4 ++ 2 files changed, 68 insertions(+) create mode 100644 .github/workflows/release-tip.yml diff --git a/.github/workflows/release-tip.yml b/.github/workflows/release-tip.yml new file mode 100644 index 000000000..c7e8e34e7 --- /dev/null +++ b/.github/workflows/release-tip.yml @@ -0,0 +1,64 @@ +on: + workflow_run: + workflows: [Test] + types: [completed] + branches: [main] + +name: Release Tip + +jobs: + build-macos: + if: ${{ 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 + if: startsWith(github.ref, 'refs/tags/') + with: + name: "Ghostty Tip (\"Nightly\")" + prerelease: true + tag_name: tip + files: ghostty-macos-universal.zip diff --git a/nix/devshell.nix b/nix/devshell.nix index bbabb955c..ea35aa601 100644 --- a/nix/devshell.nix +++ b/nix/devshell.nix @@ -14,6 +14,8 @@ , wasmtime , wraptest , zig +, zip +, llvmPackages_latest , bzip2 , expat @@ -55,9 +57,11 @@ in mkShell rec { nativeBuildInputs = [ # For builds + llvmPackages_latest.llvm pkg-config scdoc zig + zip # Testing gdb