From 6a97f05bec9a51f612fcfaa8d30a50f4902176fb Mon Sep 17 00:00:00 2001 From: psadi Date: Tue, 25 Mar 2025 17:28:16 +0530 Subject: [PATCH] ci: handle zig versions for stable and nightly builds ghostty uses zig version 0.13.0 for 1.1.x series where as nightly builds refers to 0.14.0, due to this the container image has to be removed to determine deps on the fly --- .github/workflows/ci.yaml | 14 +++++- .github/workflows/image.yaml | 84 ------------------------------------ Containerfile | 9 ---- setup.sh | 15 +++---- 4 files changed, 20 insertions(+), 102 deletions(-) delete mode 100644 .github/workflows/image.yaml delete mode 100644 Containerfile diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5b23c1d..222828b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -33,7 +33,7 @@ jobs: platform: linux/amd64 runs-on: ubuntu-24.04 container: - image: ghcr.io/psadi/ghostty-appimage:latest + image: ghcr.io/pkgforge-dev/archlinux:latest steps: - name: Checkout ghostty-appimage uses: actions/checkout@v4 @@ -45,12 +45,24 @@ jobs: uses: actions/cache@v4 with: path: | + /var/cache/pacman /tmp/offline-cache /root/.cache/zig key: ${{ runner.os }}-${{ matrix.arch }}-ghostty-${{ hashFiles('**/VERSION') }} restore-keys: | ${{ runner.os }}-${{ matrix.arch }}-ghostty- + - name: Setup build environment + run: | + if [ "${{ github.event_name }}" == "schedule" ]; then + ZIG_VERSION=0.14.0 + else + ZIG_VERSION=0.13.0 + fi + + sed -i "s/#ZIG_VERSION/${ZIG_VERSION}/g" setup.sh + ./setup.sh + - name: Build Ghostty AppImage run: | if [ "${{ github.event_name }}" == "schedule" ]; then diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml deleted file mode 100644 index af623a1..0000000 --- a/.github/workflows/image.yaml +++ /dev/null @@ -1,84 +0,0 @@ -name: Build Image -concurrency: - group: build-${{ github.ref }} - cancel-in-progress: true - -on: - workflow_dispatch: {} - push: - paths: - - "Containerfile" - - "setup.sh" - -jobs: - buid_base_image: - name: 👻 Build Ghossty Base Image - permissions: - contents: read - packages: write - runs-on: ubuntu-latest - steps: - - name: Debloat Runner - run: | - set +x ; set +e - bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Github/Runners/debloat_ubuntu.sh") - continue-on-error: true - - - name: Checkout ghostty-appimage - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Setup Env - run: | - set +x ; set +e - DOCKER_TAG="v$(date +'%Y.%m.%d')" && export DOCKER_TAG="$DOCKER_TAG" - echo "DOCKER_TAG=$DOCKER_TAG" >> "${GITHUB_ENV}" - echo "GHCR_NAME=ghcr.io/psadi/ghostty-appimage" >> "${GITHUB_ENV}" - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - continue-on-error: true - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - continue-on-error: true - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: "${{ secrets.DOCKER_USERNAME }}" - password: "${{ secrets.DOCKER_PASSWORD }}" - continue-on-error: true - - - name: Log in to Ghcr registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: "${{ github.actor }}" - password: "${{ secrets.GITHUB_TOKEN }}" - - - name: Build and push - uses: docker/build-push-action@v6 - with: - file: Containerfile - push: ${{ github.ref_name == 'main' }} - platforms: "linux/amd64,linux/arm64" - tags: | - ${{ env.GHCR_NAME }}:latest - ${{ env.GHCR_NAME }}:${{ env.DOCKER_TAG }} - - # clean: - # needs: - # - buid_base_image - # runs-on: ubuntu-latest - # name: Delete old test images - # steps: - # - uses: snok/container-retention-policy@v3.0.0 - # with: - # account: psadi - # token: ${{ secrets.GITHUB_TOKEN }} - # image-names: "ghostty-appimage" - # cut-off: 2w - # keep-n-most-recent: 2 - # dry-run: true diff --git a/Containerfile b/Containerfile deleted file mode 100644 index 29d91d7..0000000 --- a/Containerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ghcr.io/pkgforge-dev/archlinux:latest - -LABEL org.opencontainers.image.source="https://github.com/psadi/ghostty-appimage" -LABEL org.opencontainers.image.description="Container image for ghostty-appimage dependencies" -LABEL org.opencontainers.image.licenses="MIT" - -COPY setup.sh setup.sh - -RUN sh setup.sh diff --git a/setup.sh b/setup.sh index fac70b5..02db8f8 100755 --- a/setup.sh +++ b/setup.sh @@ -12,11 +12,12 @@ get_latest_gh_release() { # Update & install OS base dependencies buildDeps="base-devel freetype2 oniguruma wget mesa file zsync appstream xorg-server-xvfb patchelf binutils strace git jq" ghosttyDeps="gtk4 libadwaita blueprint-compiler gtk4-layer-shell" +rm -rf "/usr/share/libalpm/hooks/package-cleanup.hook" pacman -Syuq --needed --noconfirm --noprogressbar ${buildDeps} ${ghosttyDeps} export ARCH="$(uname -m)" -ZIG_VERSION="0.13.0" +ZIG_VERSION="#ZIG_VERSION" PANDOC_VERSION="$(get_latest_gh_release 'jgm/pandoc')" MINISIGN_VERSION="$(get_latest_gh_release 'jedisct1/minisign')" SHARUN_VERSION="$(get_latest_gh_release 'VHSgunzo/sharun')" @@ -55,13 +56,11 @@ pacman -U --noconfirm /tmp/llvm-libs.pkg.tar.zst /tmp/libxml2.pkg.tar.zst # Download & install other dependencies # zig: https://ziglang.org -if [ ! -d "/opt/zig-linux-${ARCH}-${ZIG_VERSION}" ]; then - rm -rf /opt/zig* - unlink /usr/local/bin/zig || true - wget "${ZIG_URL}" -O /tmp/zig-linux.tar.xz - tar -xJf /tmp/zig-linux.tar.xz -C /opt - ln -s "/opt/zig-linux-${ARCH}-${ZIG_VERSION}/zig" /usr/local/bin/zig -fi +rm -rf /opt/zig* +unlink /usr/local/bin/zig || true +wget "${ZIG_URL}" -O /tmp/zig-linux.tar.xz +tar -xJf /tmp/zig-linux.tar.xz -C /opt +ln -s "/opt/zig-linux-${ARCH}-${ZIG_VERSION}/zig" /usr/local/bin/zig # appimagetool: https://github.com/AppImage/appimagetool rm -rf /usr/local/bin/appimagetool