2023-06-05 13:44:12 +00:00
|
|
|
name: Flatpak Build Steps
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
jobName:
|
|
|
|
required: true
|
|
|
|
type: string
|
2024-01-06 20:44:44 +00:00
|
|
|
artifactPrefixName:
|
|
|
|
required: true
|
|
|
|
type: string
|
2023-06-05 13:44:12 +00:00
|
|
|
os:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: ubuntu-22.04
|
|
|
|
platform:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: x64
|
|
|
|
compiler:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
cmakeflags:
|
|
|
|
required: true
|
|
|
|
type: string
|
2023-06-29 14:42:41 +00:00
|
|
|
branch:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: "stable"
|
2023-06-05 13:44:12 +00:00
|
|
|
publish:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2023-07-20 01:44:20 +00:00
|
|
|
patchesUrl:
|
2023-06-05 13:44:12 +00:00
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: https://github.com/PCSX2/pcsx2_patches/releases/latest/download
|
2023-07-20 01:44:20 +00:00
|
|
|
fetchTags:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2023-06-05 13:44:12 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build_linux:
|
|
|
|
name: ${{ inputs.jobName }}
|
|
|
|
runs-on: ${{ inputs.os }}
|
|
|
|
timeout-minutes: 60
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout Repository
|
2023-09-11 04:33:40 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-06-05 13:44:12 +00:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
2023-07-01 03:02:12 +00:00
|
|
|
# Hackity hack. When running the workflow on a schedule, we don't have the tag,
|
|
|
|
# it doesn't fetch tags, therefore we don't get a version. So grab them manually.
|
2023-07-11 07:10:03 +00:00
|
|
|
# actions/checkout elides tags, fetch them primarily for releases
|
2023-07-01 03:02:12 +00:00
|
|
|
- name: Fetch tags
|
2023-07-20 01:44:20 +00:00
|
|
|
if: ${{ inputs.fetchTags }}
|
2023-07-01 03:02:12 +00:00
|
|
|
run: git fetch --tags --no-recurse-submodules
|
|
|
|
|
2023-06-05 13:44:12 +00:00
|
|
|
- name: Prepare Artifact Metadata
|
|
|
|
id: artifact-metadata
|
|
|
|
shell: bash
|
|
|
|
env:
|
2024-01-06 20:44:44 +00:00
|
|
|
PREFIX: ${{ inputs.artifactPrefixName }}
|
2023-06-05 13:44:12 +00:00
|
|
|
EVENT_NAME: ${{ github.event_name }}
|
|
|
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
|
|
|
PR_NUM: ${{ github.event.pull_request.number }}
|
|
|
|
PR_SHA: ${{ github.event.pull_request.head.sha }}
|
|
|
|
run: ./.github/workflows/scripts/common/name-artifacts.sh
|
|
|
|
|
|
|
|
- name: Install Packages
|
|
|
|
env:
|
|
|
|
COMPILER: ${{ inputs.compiler }}
|
|
|
|
run: .github/workflows/scripts/linux/install-packages-flatpak.sh
|
|
|
|
|
|
|
|
- name: Download patches
|
|
|
|
run: |
|
|
|
|
cd bin/resources
|
2023-07-20 01:44:20 +00:00
|
|
|
aria2c -Z "${{ inputs.patchesUrl }}/patches.zip"
|
2023-06-05 13:44:12 +00:00
|
|
|
|
|
|
|
- name: Generate AppStream XML
|
|
|
|
run: |
|
|
|
|
./.github/workflows/scripts/linux/generate-metainfo.sh .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.metainfo.xml
|
|
|
|
cat .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.metainfo.xml
|
2023-06-29 14:55:39 +00:00
|
|
|
flatpak run org.freedesktop.appstream-glib validate .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.metainfo.xml
|
2023-06-05 13:44:12 +00:00
|
|
|
|
2023-10-28 08:32:23 +00:00
|
|
|
- name: Validate manifest
|
|
|
|
run: |
|
|
|
|
flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.json
|
|
|
|
|
2023-06-05 13:44:12 +00:00
|
|
|
- name: Build Flatpak
|
2024-01-06 20:44:44 +00:00
|
|
|
# TODO - based on v6.3, switch back to the main action once change is accepted (or they release a breaking change that uses upload-artifact@v4)
|
|
|
|
uses: xTVaser/flatpak-github-actions/flatpak-builder@64267d4cf01f7955a40128039d0abab17bb48aac
|
2023-06-05 13:44:12 +00:00
|
|
|
with:
|
|
|
|
bundle: ${{ steps.artifact-metadata.outputs.artifact-name }}.flatpak
|
2024-01-06 20:44:44 +00:00
|
|
|
upload-artifact: false
|
2023-06-05 13:44:12 +00:00
|
|
|
manifest-path: .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.json
|
|
|
|
arch: x86_64
|
|
|
|
build-bundle: true
|
|
|
|
verbose: true
|
2023-06-22 07:59:33 +00:00
|
|
|
mirror-screenshots-url: https://dl.flathub.org/repo/screenshots
|
2023-06-29 14:42:41 +00:00
|
|
|
branch: ${{ inputs.branch }}
|
2023-06-05 13:44:12 +00:00
|
|
|
cache: true
|
|
|
|
restore-cache: true
|
2023-07-09 11:16:46 +00:00
|
|
|
cache-key: ${{ inputs.os }} ${{ inputs.platform }} ${{ inputs.compiler }} flatpak ${{ hashFiles('.github/workflows/scripts/linux/flatpak/**/*.json') }}
|
2023-06-05 13:44:12 +00:00
|
|
|
|
2023-06-22 07:59:33 +00:00
|
|
|
- name: Commit screenshots to OSTree
|
|
|
|
run: |
|
2023-07-01 07:41:19 +00:00
|
|
|
ostree commit --repo=repo --canonical-permissions --branch=screenshots/x86_64 flatpak_app/screenshots
|
2023-06-22 07:59:33 +00:00
|
|
|
|
2023-11-14 02:38:48 +00:00
|
|
|
#- name: Validate build directory
|
|
|
|
# run: |
|
|
|
|
# flatpak run --command=flatpak-builder-lint org.flatpak.Builder builddir flatpak_app
|
|
|
|
#
|
|
|
|
#- name: Validate repo
|
|
|
|
# run: |
|
|
|
|
# flatpak run --command=flatpak-builder-lint org.flatpak.Builder repo repo
|
2023-10-28 08:32:23 +00:00
|
|
|
|
2023-06-29 14:42:41 +00:00
|
|
|
- name: Push to Flathub beta
|
|
|
|
if: inputs.publish == true && inputs.branch == 'beta'
|
2023-10-23 04:21:43 +00:00
|
|
|
uses: flatpak/flatpak-github-actions/flat-manager@v6.3
|
2023-06-26 11:51:20 +00:00
|
|
|
with:
|
|
|
|
flat-manager-url: https://hub.flathub.org/
|
|
|
|
repository: beta
|
|
|
|
token: ${{ secrets.FLATHUB_BETA_TOKEN }}
|
2023-06-29 14:42:41 +00:00
|
|
|
|
|
|
|
- name: Push to Flathub stable
|
|
|
|
if: inputs.publish == true && inputs.branch == 'stable'
|
2023-10-23 04:21:43 +00:00
|
|
|
uses: flatpak/flatpak-github-actions/flat-manager@v6.3
|
2023-06-29 14:42:41 +00:00
|
|
|
with:
|
|
|
|
flat-manager-url: https://hub.flathub.org/
|
|
|
|
repository: stable
|
|
|
|
token: ${{ secrets.FLATHUB_TOKEN }}
|
|
|
|
|
2024-01-06 20:44:44 +00:00
|
|
|
# NOTE - this is done after on purpose so the flatpak file is wherever it needs to be for the previous pushes
|
|
|
|
- name: Prepare artifacts folder
|
|
|
|
# NOTE - 'flatpak-builder' dumps the artifact out into the current directory
|
|
|
|
run: |
|
|
|
|
mkdir -p "$GITHUB_WORKSPACE"/ci-artifacts/
|
|
|
|
mv "./${{ steps.artifact-metadata.outputs.artifact-name }}.flatpak" "$GITHUB_WORKSPACE"/ci-artifacts/
|
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: ${{ steps.artifact-metadata.outputs.artifact-name }}
|
|
|
|
path: ci-artifacts
|
|
|
|
|