6969 runs-on : [ubuntu-22.04]
7070 outputs :
7171 create_artifacts : ${{ steps.config.outputs.create_artifacts }}
72+ flatpak_matrix : ${{ steps.config.outputs.flatpak_matrix }}
7273 cache_date : ${{ steps.config.outputs.cache_date }}
7374 steps :
7475 - name : ' Configure Build Jobs'
8081 else
8182 echo 'create_artifacts=false' >> $GITHUB_OUTPUT
8283 fi
84+
85+ if test -n "$(curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -s "${{ github.event.pull_request.url }}" | jq -e '.labels[] | select(.name == "Flatpak aarch64")')"; then
86+ echo 'flatpak_matrix=["x86_64", "aarch64"]' >> $GITHUB_OUTPUT
87+ else
88+ echo 'flatpak_matrix=["x86_64"]' >> $GITHUB_OUTPUT
89+ fi
8390 else
8491 echo 'create_artifacts=true' >> $GITHUB_OUTPUT
92+ echo 'flatpak_matrix=["x86_64"]' >> $GITHUB_OUTPUT
8593 fi
8694 echo "cache_date=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT
8795
@@ -362,8 +370,8 @@ jobs:
362370 name : ' obs-studio-windows-${{ matrix.arch }}-${{ steps.setup.outputs.commitHash }}'
363371 path : ' ${{ env.FILE_NAME }}'
364372
365- linux_package :
366- name : ' 02 - Flatpak'
373+ flatpak_deps_build :
374+ name : ' 02 - Flatpak Dependencies '
367375 runs-on : [ubuntu-latest]
368376 needs : [config, clang_check]
369377 defaults :
@@ -372,6 +380,74 @@ jobs:
372380 container :
373381 image : bilelmoussaoui/flatpak-github-actions:kde-6.4
374382 options : --privileged
383+ strategy :
384+ matrix :
385+ arch : ${{ fromJSON(needs.config.outputs.flatpak_matrix) }}
386+ outputs :
387+ cache_key : ${{ steps.setup.outputs.cache_key }}
388+ steps :
389+
390+ - name : ' Checkout'
391+ uses : actions/checkout@v3
392+ with :
393+ submodules : ' recursive'
394+ fetch-depth : 0
395+
396+ - name : ' Setup build environment'
397+ id : setup
398+ env :
399+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
400+ CACHE_KEY : flatpak-builder-${{ hashFiles('CI/flatpak/com.obsproject.Studio.json') }}
401+ run : |
402+ if [[ "${{ matrix.arch }}" != "x86_64" ]]; then
403+ dnf install -y -q jq gh docker
404+ else
405+ dnf install -y -q jq gh
406+ fi
407+ gh extension install actions/gh-actions-cache
408+
409+ git config --global --add safe.directory $GITHUB_WORKSPACE
410+
411+ KEY="$CACHE_KEY-${{ matrix.arch }}"
412+ CACHE_HIT=$(gh actions-cache list --key $KEY | grep -q $KEY && echo 'true' || echo 'false')
413+
414+ echo "cache_key=$CACHE_KEY" >> $GITHUB_OUTPUT
415+ echo "skip_build=$CACHE_HIT" >> $GITHUB_OUTPUT
416+
417+ - name : Setup QEMU
418+ if : ${{ (matrix.arch != 'x86_64') && !fromJSON(steps.setup.outputs.skip_build) }}
419+ uses : docker/setup-qemu-action@v2
420+ with :
421+ platforms : arm64
422+
423+ - name : ' Shorten Manifest'
424+ if : ${{ !fromJSON(steps.setup.outputs.skip_build) }}
425+ run : |
426+ jq 'del(.modules[-2:]) | .modules += [{"name": "obs", "buildsystem": "simple", "build-commands": ["cp -a /usr/bin/ls /app/bin/obs"]}]' CI/flatpak/com.obsproject.Studio.json > tmp.json
427+ mv tmp.json CI/flatpak/com.obsproject.Studio.json
428+
429+ - name : Build Flatpak Manifest
430+ if : ${{ !fromJSON(steps.setup.outputs.skip_build) }}
431+ uses : flatpak/flatpak-github-actions/flatpak-builder@v5
432+ with :
433+ build-bundle : false
434+ manifest-path : CI/flatpak/com.obsproject.Studio.json
435+ cache-key : ${{ steps.setup.outputs.cache_key }}
436+ arch : ${{ matrix.arch }}
437+
438+ flatpak_build :
439+ name : ' 03 - Flatpak'
440+ runs-on : [ubuntu-latest]
441+ needs : [config, flatpak_deps_build]
442+ defaults :
443+ run :
444+ shell : bash
445+ container :
446+ image : bilelmoussaoui/flatpak-github-actions:kde-6.4
447+ options : --privileged
448+ strategy :
449+ matrix :
450+ arch : ${{ fromJSON(needs.config.outputs.flatpak_matrix) }}
375451 steps :
376452
377453 - name : ' Checkout'
@@ -381,19 +457,28 @@ jobs:
381457 fetch-depth : 0
382458
383459 - name : ' Setup build environment'
460+ id : setup
384461 run : |
462+ [[ "${{ matrix.arch }}" != "x86_64" ]] && dnf install -y -q docker
463+
385464 git config --global --add safe.directory $GITHUB_WORKSPACE
386- echo "OBS_GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
387- echo "OBS_GIT_HASH=$(git rev-parse --short=9 HEAD)" >> $GITHUB_ENV
388- echo "OBS_GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
465+
466+ echo "git_hash=$(git rev-parse --short=9 HEAD)" >> $GITHUB_OUTPUT
467+
468+ - name : Setup QEMU
469+ if : ${{ matrix.arch != 'x86_64' }}
470+ uses : docker/setup-qemu-action@v2
471+ with :
472+ platforms : arm64
389473
390474 - name : Build Flatpak Manifest
391475 uses : flatpak/flatpak-github-actions/flatpak-builder@v5
392476 with :
393477 build-bundle : ${{ fromJSON(needs.config.outputs.create_artifacts) }}
394- bundle : obs-studio-flatpak-${{ env.OBS_GIT_HASH }}.flatpak
478+ bundle : obs-studio-flatpak-${{ steps.setup.outputs.git_hash }}.flatpak
395479 manifest-path : CI/flatpak/com.obsproject.Studio.json
396- cache-key : flatpak-builder-${{ hashFiles('CI/flatpak/com.obsproject.Studio.json') }}
480+ cache-key : ${{ needs.flatpak_deps_build.outputs.cache_key }}
481+ arch : ${{ matrix.arch }}
397482
398483 windows_package :
399484 name : ' 03 - Windows Installer'
0 commit comments