Skip to content

Commit 8b7353c

Browse files
author
psadi
committed
ci: add setup, build and gh workflow scripts
1 parent 47197d8 commit 8b7353c

File tree

4 files changed

+142
-29
lines changed

4 files changed

+142
-29
lines changed

.github/workflows/ci.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
name: Build Ghostty AppImage
3+
4+
on:
5+
workflow_dispatch: {}
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
release:
9+
types: [published]
10+
11+
permissions:
12+
actions: read
13+
security-events: write
14+
contents: write
15+
16+
jobs:
17+
build_appimage:
18+
name: Build Ghostty
19+
runs-on: ubuntu-24.04
20+
container:
21+
image: ubuntu:24.04
22+
options: "--privileged --cap-add SYS_ADMIN --device /dev/fuse"
23+
steps:
24+
- name: Checkout ghostty-appimage
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Build Env
28+
run: ./setup.sh
29+
30+
- name: Build Ghostty
31+
run: ./build.sh
32+
33+
- name: Upload Artifact
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: ghostty-appimage
37+
retention-days: 7
38+
path: /tmp/ghostty-build/Ghostty-x86_64.AppImage
39+
40+
release_appimage:
41+
name: "Upload binaries to current release"
42+
runs-on: ubuntu-latest
43+
# if: ${{ github.event_name == 'release' }}
44+
needs: "build_appimage"
45+
steps:
46+
- uses: actions/download-artifact@v4
47+
with:
48+
name: ghostty-appimage
49+
50+
- name: Upload binaries to release
51+
uses: svenstaro/upload-release-action@v2
52+
with:
53+
repo_token: ${{ secrets.GITHUB_TOKEN }}
54+
file: ./Ghostty-x86_64.AppImage
55+
tag: ${{ github.ref }}
56+
overwrite: true
57+
file_glob: true

Justfile

Lines changed: 0 additions & 29 deletions
This file was deleted.

build.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
GHOSTTY_VERSION="1.0.1"
6+
TMP_DIR="/tmp/ghostty-build"
7+
APP_DIR="${TMP_DIR}/ghostty.AppDir"
8+
PUB_KEY="RWQlAjJC23149WL2sEpT/l0QKy7hMIFhYdQOFy0Z7z7PbneUgvlsnYcV"
9+
10+
rm -rf "${TMP_DIR}"
11+
12+
mkdir -p -- "${TMP_DIR}" "${APP_DIR}/usr"
13+
14+
cd "${TMP_DIR}"
15+
16+
wget -q "https://release.files.ghostty.org/${GHOSTTY_VERSION}/ghostty-${GHOSTTY_VERSION}.tar.gz"
17+
wget -q "https://release.files.ghostty.org/${GHOSTTY_VERSION}/ghostty-${GHOSTTY_VERSION}.tar.gz.minisig"
18+
19+
minisign -V -m "ghostty-${GHOSTTY_VERSION}.tar.gz" -P "${PUB_KEY}" -s "ghostty-${GHOSTTY_VERSION}.tar.gz.minisig"
20+
21+
rm ghostty-${GHOSTTY_VERSION}.tar.gz.minisig
22+
23+
tar -xzmf "ghostty-${GHOSTTY_VERSION}.tar.gz"
24+
25+
rm "ghostty-${GHOSTTY_VERSION}.tar.gz"
26+
27+
cd "${TMP_DIR}/ghostty-${GHOSTTY_VERSION}"
28+
29+
sed -i 's/linkSystemLibrary2("bzip2", dynamic_link_opts)/linkSystemLibrary2("bz2", dynamic_link_opts)/' build.zig
30+
31+
# Fetch Zig Cache
32+
ZIG_GLOBAL_CACHE_DIR=/tmp/offline-cache ./nix/build-support/fetch-zig-cache.sh
33+
34+
# Build Ghostty with zig
35+
zig build \
36+
--summary all \
37+
--prefix "${APP_DIR}/usr" \
38+
--system /tmp/offline-cache/p \
39+
-Doptimize=ReleaseFast \
40+
-Dcpu=baseline \
41+
-Dpie=true \
42+
-Demit-docs \
43+
-Dversion-string="${GHOSTTY_VERSION}"
44+
45+
cd "${APP_DIR}"
46+
47+
# prep appimage
48+
printf '#!/bin/sh\n\nexec "$(dirname "$(readlink -f "$0")")/usr/bin/ghostty"\n' | tee AppRun > /dev/null
49+
chmod +x AppRun
50+
ln -s usr/share/applications/com.mitchellh.ghostty.desktop
51+
ln -s usr/share/icons/hicolor/256x256/apps/com.mitchellh.ghostty.png
52+
53+
cd "${TMP_DIR}"
54+
# create app image
55+
ARCH=x8_64 appimagetool "${APP_DIR}"

setup.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
export DEBIAN_FRONTEND="noninteractive"
6+
7+
ZIG_VERSION="0.13.0"
8+
9+
# update & install os base dependencies
10+
buildPkgs="build-essential libonig-dev libbz2-dev pandoc wget fuse libfuse2t64 file"
11+
ghosttyPkgs="libgtk-4-dev libadwaita-1-dev"
12+
apt-get -qq update && apt-get -qq -y upgrade && apt-get -qq -y install $buildPkgs $ghosttyPkgs
13+
14+
# download & install other dependencie
15+
# appimagetool: https://github.com/AppImage/appimagetool
16+
wget -q "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage"
17+
install appimagetool-x86_64.AppImage /usr/local/bin/appimagetool
18+
rm appimagetool-x86_64.AppImage
19+
20+
# minisign: https://github.com/jedisct1/minisign
21+
wget -q "https://github.com/jedisct1/minisign/releases/download/0.11/minisign-0.11-linux.tar.gz"
22+
tar -xzf minisign-0.11-linux.tar.gz
23+
mv minisign-linux/x86_64/minisign /usr/local/bin
24+
rm -r minisign-0.11-linux.tar.gz
25+
26+
# zig: https://ziglang.org
27+
wget -q "https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz"
28+
tar -xf "zig-linux-x86_64-${ZIG_VERSION}.tar.xz" -C /opt
29+
rm "zig-linux-x86_64-${ZIG_VERSION}.tar.xz"
30+
ln -s "/opt/zig-linux-x86_64-${ZIG_VERSION}/zig" /usr/local/bin/zig

0 commit comments

Comments
 (0)