mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-10-25 03:09:43 +01:00
This reverts commit c80866ab5c.
GH Actions refuses to give write perms to caches to PRs from outside the main repo, so this isn't actually very useful
161 lines
5.9 KiB
YAML
161 lines
5.9 KiB
YAML
name: Flatpak Build Steps
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
jobName:
|
|
required: true
|
|
type: string
|
|
artifactPrefixName:
|
|
required: true
|
|
type: string
|
|
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
|
|
publish:
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
patchesUrl:
|
|
required: false
|
|
type: string
|
|
default: https://github.com/PCSX2/pcsx2_patches/releases/latest/download
|
|
fetchTags:
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
stableBuild:
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
|
|
jobs:
|
|
build_linux:
|
|
name: ${{ inputs.jobName }}
|
|
runs-on: ${{ inputs.os }}
|
|
container:
|
|
image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.9
|
|
options: --privileged
|
|
timeout-minutes: 60
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
set-safe-directory: ${{ env.GITHUB_WORKSPACE }}
|
|
# 10 here, since the odds of having 10 untagged commits in a row should be slim to none
|
|
# This is required for the tagging logic in generate-metainfo.sh
|
|
fetch-depth: 10
|
|
fetch-tags: true
|
|
|
|
# Work around container ownership issue
|
|
- name: Set Safe Directory
|
|
shell: bash
|
|
run: git config --global --add safe.directory "*"
|
|
|
|
- name: Add stable release identifier file
|
|
if: ${{ inputs.stableBuild == true || inputs.stableBuild == 'true' }}
|
|
shell: bash
|
|
run: |
|
|
echo "#define DEFAULT_UPDATER_CHANNEL \"stable\"" > ./pcsx2-qt/DefaultUpdaterChannel.h
|
|
cat ./pcsx2-qt/DefaultUpdaterChannel.h
|
|
|
|
- name: Prepare Artifact Metadata
|
|
id: artifact-metadata
|
|
shell: bash
|
|
env:
|
|
PREFIX: ${{ inputs.artifactPrefixName }}
|
|
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: Download patches
|
|
run: |
|
|
cd bin/resources
|
|
wget "${{ inputs.patchesUrl }}/patches.zip"
|
|
|
|
- name: Validate manifest
|
|
run: |
|
|
flatpak-builder-lint manifest .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.json
|
|
|
|
- name: Build Flatpak (beta)
|
|
if: ${{ inputs.stableBuild == false || inputs.stableBuild == 'false' }}
|
|
uses: flatpak/flatpak-github-actions/flatpak-builder@92ae9851ad316786193b1fd3f40c4b51eb5cb101
|
|
with:
|
|
bundle: ${{ steps.artifact-metadata.outputs.artifact-name }}.flatpak
|
|
upload-artifact: false
|
|
manifest-path: .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.json
|
|
arch: x86_64
|
|
build-bundle: true
|
|
verbose: true
|
|
mirror-screenshots-url: https://dl.flathub.org/media
|
|
branch: beta
|
|
cache: true
|
|
restore-cache: true
|
|
cache-key: ${{ inputs.os }} ${{ inputs.platform }} ${{ inputs.compiler }} flatpak ${{ hashFiles('.github/workflows/scripts/linux/flatpak/**/*.json', '.github/workflows/scripts/common/*.patch') }}
|
|
|
|
- name: Build Flatpak (stable)
|
|
if: ${{ inputs.stableBuild == true || inputs.stableBuild == 'true' }}
|
|
uses: flatpak/flatpak-github-actions/flatpak-builder@92ae9851ad316786193b1fd3f40c4b51eb5cb101
|
|
with:
|
|
bundle: ${{ steps.artifact-metadata.outputs.artifact-name }}.flatpak
|
|
upload-artifact: false
|
|
manifest-path: .github/workflows/scripts/linux/flatpak/net.pcsx2.PCSX2.json
|
|
arch: x86_64
|
|
build-bundle: true
|
|
verbose: true
|
|
mirror-screenshots-url: https://dl.flathub.org/media
|
|
branch: stable
|
|
cache: true
|
|
restore-cache: true
|
|
cache-key: ${{ inputs.os }} ${{ inputs.platform }} ${{ inputs.compiler }} flatpak ${{ hashFiles('.github/workflows/scripts/linux/flatpak/**/*.json') }}
|
|
|
|
#- name: Validate build
|
|
# run: |
|
|
# flatpak-builder-lint repo repo
|
|
|
|
- name: Push to Flathub (beta)
|
|
if: ${{ inputs.publish == true && (inputs.stableBuild == false || inputs.stableBuild == 'false') }}
|
|
uses: flatpak/flatpak-github-actions/flat-manager@92ae9851ad316786193b1fd3f40c4b51eb5cb101
|
|
with:
|
|
flat-manager-url: https://hub.flathub.org/
|
|
repository: beta
|
|
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.publish == true && (inputs.stableBuild == true || inputs.stableBuild == 'true') }}
|
|
uses: flatpak/flatpak-github-actions/flat-manager@92ae9851ad316786193b1fd3f40c4b51eb5cb101
|
|
with:
|
|
flat-manager-url: https://hub.flathub.org/
|
|
repository: stable
|
|
token: ${{ secrets.FLATHUB_TOKEN }}
|
|
build-log-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
|
|
# 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@v7
|
|
with:
|
|
name: ${{ steps.artifact-metadata.outputs.artifact-name }}
|
|
path: ci-artifacts
|
|
|