name: 📦 Linux Flatpak on: workflow_call: inputs: flathub_publish: required: false type: boolean default: false flathub_branch: required: false type: string default: "stable" jobs: linux-flatpak-build: name: "Build" strategy: fail-fast: true matrix: setup: [{arch: "x86_64", ainame: "x64", runner: "ubuntu-22.04"}, {arch: "aarch64", ainame: "arm64", runner: "ubuntu-24.04-arm"}] runs-on: ${{ matrix.setup.runner }} container: image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-24.08 options: --privileged timeout-minutes: 60 steps: - uses: actions/checkout@v5 with: fetch-depth: 0 set-safe-directory: ${{ env.GITHUB_WORKSPACE }} # Work around container ownership issue - name: Set Safe Directory shell: bash run: git config --global --add safe.directory "*" - name: Download Artifacts uses: actions/download-artifact@v4 with: name: "linux-${{ matrix.setup.ainame }}-appimage" path: ./artifacts/ - name: Move AppImage shell: bash run: | mv "./artifacts/DuckStation-${{ matrix.setup.ainame }}.AppImage" "scripts/packaging/flatpak/DuckStation.AppImage" - name: Generate AppStream XML run: | scripts/packaging/generate-metainfo.sh scripts/packaging/flatpak cat scripts/packaging/flatpak/org.duckstation.DuckStation.metainfo.xml - name: Validate AppStream XML run: flatpak-builder-lint appstream scripts/packaging/flatpak/org.duckstation.DuckStation.metainfo.xml - name: Validate Manifest run: flatpak-builder-lint manifest scripts/packaging/flatpak/org.duckstation.DuckStation.yaml - name: Build Flatpak uses: flatpak/flatpak-github-actions/flatpak-builder@v6 with: bundle: duckstation-${{ matrix.setup.arch }}.flatpak upload-artifact: false manifest-path: scripts/packaging/flatpak/org.duckstation.DuckStation.yaml arch: ${{ matrix.setup.arch }} build-bundle: true verbose: true mirror-screenshots-url: https://dl.flathub.org/media branch: stable cache: true restore-cache: true cache-key: flatpak-${{ hashFiles('scripts/packaging/flatpak/org.duckstation.DuckStation.yaml') }} - name: Validate Build run: | flatpak-builder-lint repo repo - name: Push To Flathub Beta if: inputs.flathub_publish && inputs.flathub_branch == 'beta' uses: flatpak/flatpak-github-actions/flat-manager@v6 with: flat-manager-url: https://hub.flathub.org/ repository: stable token: ${{ secrets.FLATHUB_BETA_TOKEN }} build-log-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - name: Push To Flathub Stable if: inputs.flathub_publish && inputs.flathub_branch == 'stable' uses: flatpak/flatpak-github-actions/flat-manager@v6 with: flat-manager-url: https://hub.flathub.org/ repository: stable token: ${{ secrets.FLATHUB_STABLE_TOKEN }} build-log-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - name: Upload Flatpak uses: actions/upload-artifact@v4 with: name: "linux-flatpak-${{ matrix.setup.arch }}" path: "duckstation-${{ matrix.setup.arch }}.flatpak"