diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c60200f..de41b6a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,4 @@ ---- name: Build - on: workflow_dispatch: {} pull_request: @@ -14,29 +12,47 @@ jobs: actions: read security-events: write contents: write - name: Build Ghostty + name: Build Ghostty (${{ matrix.arch }}) runs-on: ubuntu-24.04 - container: - image: ubuntu:24.04 - options: "--privileged --cap-add SYS_ADMIN --device /dev/fuse" + strategy: + matrix: + include: + - arch: aarch64 + platform: linux/arm64 + - arch: x86_64 + platform: linux/amd64 steps: - name: Checkout ghostty-appimage uses: actions/checkout@v4 with: persist-credentials: false - - name: Setup Build Env - run: ./setup.sh + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + continue-on-error: true - - name: Build Ghostty - run: ./build.sh + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + continue-on-error: true + + - name: Build in Docker + run: | + docker run --rm --privileged \ + --cap-add SYS_ADMIN \ + --device /dev/fuse \ + --platform ${{ matrix.platform }} \ + -v ${{ github.workspace }}:/work \ + -v /tmp:/tmp \ + -w /work \ + ubuntu:24.04 \ + bash -c "./setup.sh && ./build.sh" - name: Upload Artifact uses: actions/upload-artifact@v4 with: - name: ghostty-appimage + name: ghostty-appimage-${{ matrix.arch }} retention-days: 7 - path: /tmp/ghostty-build/Ghostty-*-x86_64.AppImage* + path: /tmp/ghostty-build/Ghostty-*-${{ matrix.arch }}.AppImage* release_appimage: permissions: @@ -45,18 +61,19 @@ jobs: contents: write name: "Upload binaries to current release" runs-on: ubuntu-latest - if: ${{ github.event_name == 'release' }} + #if: ${{ github.event_name == 'release' }} needs: "build_appimage" steps: - uses: actions/download-artifact@v4 with: - name: ghostty-appimage + pattern: ghostty-appimage-* + merge-multiple: true - name: Upload binaries to release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./Ghostty-*-x86_64.AppImage* + file: ./Ghostty-*-*.AppImage* tag: ${{ github.ref }} overwrite: true file_glob: true diff --git a/build.sh b/build.sh index 45a6881..fadd992 100755 --- a/build.sh +++ b/build.sh @@ -62,10 +62,22 @@ cd "${APP_DIR}" # bundle all libs ldd ./usr/bin/ghostty | awk -F"[> ]" '{print $4}' | xargs -I {} cp --update=none -v {} ./usr/lib -if ! mv ./usr/lib/ld-linux-x86-64.so.2 ./; then - cp -v /lib64/ld-linux-x86-64.so.2 ./ + +# ld-linux contains x86-64 instead of x86_64. +if [ "$ARCH" = "x86_64" ]; then + if ! mv ./usr/lib/ld-linux-x86-64.so.2 ./ld-linux.so; then + cp -v /lib64/ld-linux-x86-64.so.2 ./ld-linux.so + fi +elif [ "$ARCH" = "aarch64" ]; then + if ! mv ./usr/lib/ld-linux-aarch64.so.1 ./ld-linux.so; then + cp -v /lib64/ld-linux-aarch64.so.1 ./ld-linux.so + fi +else + exit 1 fi + + # Prepare AppImage -- Configure launcher script, metainfo and desktop file with icon. cat <<'EOF' >./AppRun #!/usr/bin/env sh @@ -75,7 +87,7 @@ HERE="$(dirname "$(readlink -f "$0")")" export TERM=xterm-256color export GHOSTTY_RESOURCES_DIR="${HERE}/usr/share/ghostty" -exec "${HERE}"/ld-linux-x86-64.so.2 --library-path "${HERE}"/usr/lib "${HERE}"/usr/bin/ghostty "$@" +exec "${HERE}"/ld-linux.so --library-path "${HERE}"/usr/lib "${HERE}"/usr/bin/ghostty "$@" EOF chmod +x AppRun diff --git a/setup.sh b/setup.sh index 442a1e3..5b5c0e5 100755 --- a/setup.sh +++ b/setup.sh @@ -3,6 +3,7 @@ set -e export DEBIAN_FRONTEND="noninteractive" +export ARCH="$(uname -m)" ZIG_VERSION="0.13.0" MINISIGN_URL="https://github.com/jedisct1/minisign/releases/download/0.11/minisign-0.11-linux.tar.gz" @@ -29,22 +30,22 @@ apt-get -qq update && apt-get -qq -y upgrade && apt-get -qq -y install ${buildPk # download & install other dependencies # appimagetool: https://github.com/AppImage/appimagetool -wget -q "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" -install appimagetool-x86_64.AppImage /usr/local/bin/appimagetool +wget -q "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-${ARCH}.AppImage" +install "appimagetool-${ARCH}.AppImage" /usr/local/bin/appimagetool # minisign: https://github.com/jedisct1/minisign wget -q "${MINISIGN_URL}" -O "minisign-linux.tar.gz" tar -xzf "minisign-linux.tar.gz" -mv minisign-linux/x86_64/minisign /usr/local/bin +mv minisign-linux/"${ARCH}"/minisign /usr/local/bin # zig: https://ziglang.org -wget -q "https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz" -tar -xf "zig-linux-x86_64-${ZIG_VERSION}.tar.xz" -C /opt -ln -s "/opt/zig-linux-x86_64-${ZIG_VERSION}/zig" /usr/local/bin/zig +wget -q "https://ziglang.org/download/${ZIG_VERSION}/zig-linux-${ARCH}-${ZIG_VERSION}.tar.xz" +tar -xf "zig-linux-${ARCH}-${ZIG_VERSION}.tar.xz" -C /opt +ln -s "/opt/zig-linux-${ARCH}-${ZIG_VERSION}/zig" /usr/local/bin/zig # cleanup rm -r \ - "appimagetool-x86_64.AppImage" \ + "appimagetool-${ARCH}.AppImage" \ "minisign-linux.tar.gz" \ "minisign-linux" \ - "zig-linux-x86_64-${ZIG_VERSION}.tar.xz" + "zig-linux-${ARCH}-${ZIG_VERSION}.tar.xz"