From 6a02a13f22f2d91628a01af5c745a162cb383a96 Mon Sep 17 00:00:00 2001 From: 1jamie Date: Tue, 25 Aug 2026 15:32:29 -0500 Subject: [PATCH] ci(linux): build and publish Flatpak on release and path-gated PR CI Add a ubuntu-24.04 linux-flatpak job that runs build_flatpak.sh from the shared love payload, wire it into release staging/upload, and mirror a path-gated Flatpak build in ci.yml when flatpak packaging changes. --- .github/workflows/ci.yml | 50 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 43 ++++++++++++++++++++++++++++-- docs/linux-flatpak.md | 5 ++++ 3 files changed, 96 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61e838dc..587e557c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -333,6 +333,56 @@ jobs: if-no-files-found: error retention-days: 7 + linux-flatpak-changes: + name: detect Linux Flatpak changes + runs-on: ubuntu-latest + outputs: + changed: ${{ steps.paths.outputs.changed }} + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + - id: paths + env: + BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }} + HEAD_SHA: ${{ github.sha }} + run: | + if [ -z "$BASE_SHA" ] || [ "$BASE_SHA" = "0000000000000000000000000000000000000000" ]; then + echo "changed=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + if git diff --name-only "$BASE_SHA" "$HEAD_SHA" | grep -Eq '^(scripts/build_flatpak\.sh$|flatpak/|scripts/pack_love\.sh$|docs/linux-flatpak\.md$|\.github/workflows/(ci|release)\.yml$)'; then + echo "changed=true" >> "$GITHUB_OUTPUT" + else + echo "changed=false" >> "$GITHUB_OUTPUT" + fi + + linux-flatpak-build: + name: Linux Flatpak build + needs: linux-flatpak-changes + if: needs.linux-flatpak-changes.outputs.changed == 'true' + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v7 + - name: Install flatpak-builder deps + run: | + set -euo pipefail + sudo apt-get update + sudo apt-get install -y flatpak flatpak-builder elfutils imagemagick + - name: Build Flatpak bundle + run: | + set -euo pipefail + scripts/build_flatpak.sh --version 0.0.0 + - name: Upload the Flatpak + uses: actions/upload-artifact@v7 + with: + name: gen1recomp-linux-flatpak + path: | + dist/flatpak/gen1recomp-0.0.0-linux.flatpak + dist/flatpak/gen1recomp-0.0.0-linux.flatpak.sha256 + if-no-files-found: error + retention-days: 7 + headless: name: headless suites (no ROM) runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 16385ffd..ef26d7bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -173,6 +173,38 @@ jobs: if-no-files-found: error retention-days: 1 + linux-flatpak: + name: build Linux Flatpak + needs: [version, love-payload] + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v7 + - name: Install flatpak-builder deps + run: | + set -euo pipefail + sudo apt-get update + sudo apt-get install -y flatpak flatpak-builder elfutils imagemagick + - name: Download shared payload + uses: actions/download-artifact@v8 + with: + name: gen1recomp-release-love + path: .bazinga/work + - name: Build Flatpak bundle + run: | + set -euo pipefail + scripts/build_flatpak.sh \ + --version "${{ needs.version.outputs.version }}" \ + --game-love .bazinga/work/game.love + - name: Upload Flatpak release + uses: actions/upload-artifact@v7 + with: + name: gen1recomp-linux-flatpak-release + path: | + dist/flatpak/gen1recomp-${{ needs.version.outputs.version }}-linux.flatpak + dist/flatpak/gen1recomp-${{ needs.version.outputs.version }}-linux.flatpak.sha256 + if-no-files-found: error + retention-days: 1 + xbox-uwp: name: build Xbox UWP release needs: [version, love-payload] @@ -287,7 +319,7 @@ jobs: retention-days: 1 release: - needs: [version, love-payload, xbox-uwp, linux-arm64, native-tls-win] + needs: [version, love-payload, xbox-uwp, linux-arm64, linux-flatpak, native-tls-win] runs-on: ${{ fromJSON(github.repository == 'bryanthaboi/gen1recomp' && '["self-hosted", "macOS"]' || '"macos-latest"') }} steps: @@ -498,6 +530,13 @@ jobs: name: gen1recomp-linux-arm64-release path: dist/linux-arm64 + - name: Download Linux Flatpak release + if: github.repository == 'bryanthaboi/gen1recomp' + uses: actions/download-artifact@v8 + with: + name: gen1recomp-linux-flatpak-release + path: dist/flatpak + - name: Stage release assets if: github.repository == 'bryanthaboi/gen1recomp' id: assets @@ -525,7 +564,7 @@ jobs: chmod +x "$outdir/gen1recomp-${v}-linux-arm64.AppImage" flatpak_bundle="dist/flatpak/gen1recomp-${v}-linux.flatpak" - [ -f "$flatpak_bundle" ] || { echo "::error::$flatpak_bundle not found (expected from scripts/build_flatpak.sh)"; exit 1; } + [ -f "$flatpak_bundle" ] || { echo "::error::$flatpak_bundle not found (expected from the linux-flatpak job)"; exit 1; } cp "$flatpak_bundle" "$outdir/gen1recomp-${v}-linux.flatpak" apk="$(find dist/android/release -name '*.apk' | head -1)" [ -n "$apk" ] || { echo "::error::no Android APK found under dist/android/release"; exit 1; } diff --git a/docs/linux-flatpak.md b/docs/linux-flatpak.md index dbaaa731..42bc4a7d 100644 --- a/docs/linux-flatpak.md +++ b/docs/linux-flatpak.md @@ -43,4 +43,9 @@ scripts/build_flatpak.sh --version X.Y.Z Requires `flatpak` + `flatpak-builder` and the Freedesktop 24.08 runtime from Flathub (installed automatically on first build). +Release CI builds the bundle on `ubuntu-24.04` (`linux-flatpak` job) from the +shared `game.love` payload and publishes `gen1recomp--linux.flatpak` +alongside the AppImages. PR CI path-gates the same script when `flatpak/` or +`scripts/build_flatpak.sh` change. + Flathub store submission is out of scope for the GitHub bundle channel.