2024-11-12 03:35:04 +00:00
|
|
|
name: 📦 Linux Flatpak
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
flathub_publish:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
flathub_branch:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: "stable"
|
2024-12-01 13:21:11 +00:00
|
|
|
workflow_dispatch:
|
2024-11-12 03:35:04 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
linux-flatpak-build:
|
|
|
|
name: "x64"
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
container:
|
|
|
|
image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.8
|
|
|
|
options: --privileged
|
|
|
|
timeout-minutes: 120
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4.1.6
|
|
|
|
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: Initialize Build Tag
|
|
|
|
run: |
|
|
|
|
echo '#pragma once' > src/scmversion/tag.h
|
|
|
|
|
|
|
|
- name: Set Build Tags
|
|
|
|
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
|
|
|
|
run: |
|
|
|
|
echo '#define SCM_RELEASE_TAGS {"latest", "preview"}' >> src/scmversion/tag.h
|
|
|
|
|
|
|
|
- name: Tag as Preview Release
|
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
run: |
|
|
|
|
echo '#define SCM_RELEASE_TAG "preview"' >> src/scmversion/tag.h
|
|
|
|
|
|
|
|
- name: Tag as Rolling Release
|
|
|
|
if: github.ref == 'refs/heads/dev'
|
|
|
|
run: |
|
|
|
|
echo '#define SCM_RELEASE_TAG "latest"' >> src/scmversion/tag.h
|
|
|
|
|
|
|
|
- name: Download Patch Archives
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cd data/resources
|
|
|
|
curl -LO "https://github.com/duckstation/chtdb/releases/download/latest/cheats.zip"
|
|
|
|
curl -LO "https://github.com/duckstation/chtdb/releases/download/latest/patches.zip"
|
|
|
|
|
|
|
|
- name: Generate AppStream XML
|
|
|
|
run: |
|
2024-12-01 04:08:59 +00:00
|
|
|
scripts/packaging/generate-metainfo.sh scripts/packaging/flatpak
|
|
|
|
cat scripts/packaging/flatpak/org.duckstation.DuckStation.metainfo.xml
|
2024-11-12 03:35:04 +00:00
|
|
|
|
|
|
|
- name: Validate AppStream XML
|
2024-12-01 04:08:59 +00:00
|
|
|
run: flatpak-builder-lint appstream scripts/packaging/flatpak/org.duckstation.DuckStation.metainfo.xml
|
2024-11-12 03:35:04 +00:00
|
|
|
|
|
|
|
- name: Validate Manifest
|
2024-12-01 04:08:59 +00:00
|
|
|
run: flatpak-builder-lint manifest scripts/packaging/flatpak/org.duckstation.DuckStation.yaml
|
2024-11-12 03:35:04 +00:00
|
|
|
|
|
|
|
- name: Build Flatpak
|
|
|
|
uses: flathub-infra/flatpak-github-actions/flatpak-builder@23796715b3dfa4c86ddf50cf29c3cc8b3c82dca8
|
|
|
|
with:
|
|
|
|
bundle: duckstation-x64.flatpak
|
|
|
|
upload-artifact: false
|
2024-12-01 04:08:59 +00:00
|
|
|
manifest-path: scripts/packaging/flatpak/org.duckstation.DuckStation.yaml
|
2024-11-12 03:35:04 +00:00
|
|
|
arch: x86_64
|
|
|
|
build-bundle: true
|
|
|
|
verbose: true
|
|
|
|
mirror-screenshots-url: https://dl.flathub.org/media
|
|
|
|
branch: stable
|
|
|
|
cache: true
|
|
|
|
restore-cache: true
|
2024-12-01 04:08:59 +00:00
|
|
|
cache-key: flatpak-x64-${{ hashFiles('scripts/packaging/flatpak/**/*.yaml') }}
|
2024-11-12 03:35:04 +00:00
|
|
|
|
|
|
|
- name: Validate Build
|
|
|
|
run: |
|
|
|
|
flatpak-builder-lint repo repo
|
|
|
|
|
|
|
|
- name: Push To Flathub Beta
|
|
|
|
if: inputs.flathub_publish && inputs.flathub_branch == 'beta'
|
|
|
|
uses: flathub-infra/flatpak-github-actions/flat-manager@b6c92176b7f578aedd80cac74cd8f0336f618e89
|
|
|
|
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: flathub-infra/flatpak-github-actions/flat-manager@b6c92176b7f578aedd80cac74cd8f0336f618e89
|
|
|
|
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.3.3
|
|
|
|
with:
|
|
|
|
name: "linux-flatpak"
|
|
|
|
path: "duckstation-x64.flatpak"
|