49c20c6cc1
Add a job where the tag is checked if it is valid, it also checks if the release should be published to Flathub beta and/or Flathub by dynamically setting the matrix.
111 lines
3.8 KiB
YAML
111 lines
3.8 KiB
YAML
---
|
|
|
|
name: Flatpak
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
branches: [master, 'release/**']
|
|
|
|
env:
|
|
TWITCH_CLIENTID: ${{ secrets.TWITCH_CLIENT_ID }}
|
|
TWITCH_HASH: ${{ secrets.TWITCH_HASH }}
|
|
RESTREAM_CLIENTID: ${{ secrets.RESTREAM_CLIENTID }}
|
|
RESTREAM_HASH: ${{ secrets.RESTREAM_HASH }}
|
|
YOUTUBE_CLIENTID: ${{ secrets.YOUTUBE_CLIENTID }}
|
|
YOUTUBE_CLIENTID_HASH: ${{ secrets.YOUTUBE_CLIENTID_HASH }}
|
|
YOUTUBE_SECRET: ${{ secrets.YOUTUBE_SECRET }}
|
|
YOUTUBE_SECRET_HASH: ${{ secrets.YOUTUBE_SECRET_HASH }}
|
|
|
|
jobs:
|
|
check_tag:
|
|
name: Check release tag
|
|
runs-on: [ubuntu-latest]
|
|
outputs:
|
|
valid_tag: ${{ steps.check_tag.outputs.valid_tag }}
|
|
matrix: ${{ steps.check_tag.outputs.matrix }}
|
|
steps:
|
|
- name: Check the tag
|
|
id: check_tag
|
|
run: |
|
|
shopt -s extglob
|
|
|
|
case ${GITHUB_REF##*/} in
|
|
+([0-9]).+([0-9]).+([0-9]) )
|
|
echo '::set-output name=valid_tag::${{ toJSON(true) }}'
|
|
echo '::set-output name=matrix::["beta", "stable"]'
|
|
;;
|
|
+([0-9]).+([0-9]).+([0-9])-@(beta|rc) )
|
|
echo '::set-output name=valid_tag::${{ toJSON(true) }}'
|
|
echo '::set-output name=matrix::["beta"]'
|
|
;;
|
|
* ) echo '::set-output name=valid_tag::${{ toJSON(false) }}' ;;
|
|
esac
|
|
|
|
publish:
|
|
name: Publish to Flathub
|
|
runs-on: [ubuntu-latest]
|
|
needs: check_tag
|
|
if: fromJSON(needs.check_tag.outputs.valid_tag)
|
|
env:
|
|
FLATPAK_BUILD_PATH: flatpak_app/files/share
|
|
container:
|
|
image: bilelmoussaoui/flatpak-github-actions:kde-5.15-21.08
|
|
options: --privileged
|
|
strategy:
|
|
matrix:
|
|
branch: ${{ fromJSON(needs.check_tag.outputs.matrix) }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: 'recursive'
|
|
|
|
- name: 'Setup build environment'
|
|
id: setup
|
|
run: |
|
|
git config --global --add safe.directory $GITHUB_WORKSPACE
|
|
echo "::set-output name=commitHash::$(git rev-parse --short=9 HEAD)"
|
|
|
|
- name: Build Flatpak Manifest
|
|
uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@master
|
|
with:
|
|
bundle: obs-studio-${{ steps.setup.outputs.commitHash }}.flatpak
|
|
manifest-path: CI/flatpak/com.obsproject.Studio.json
|
|
cache-key: flatpak-builder-${{ hashFiles('CI/flatpak/com.obsproject.Studio.json') }}
|
|
mirror-screenshots-url: https://dl.flathub.org/repo/screenshots
|
|
branch: ${{ matrix.branch }}
|
|
|
|
- name: Validate AppStream
|
|
shell: bash
|
|
working-directory: ${{ env.FLATPAK_BUILD_PATH }}
|
|
run: |
|
|
appstream-util validate appdata/com.obsproject.Studio.appdata.xml
|
|
|
|
- name: Verify icon and metadata in app-info
|
|
shell: bash
|
|
working-directory: ${{ env.FLATPAK_BUILD_PATH }}
|
|
run: |
|
|
test -f app-info/icons/flatpak/128x128/com.obsproject.Studio.png || { echo "Missing 128x128 icon in app-info" ; exit 1; }
|
|
test -f app-info/xmls/com.obsproject.Studio.xml.gz || { echo "Missing com.obsproject.Studio.xml.gz in app-info" ; exit 1; }
|
|
|
|
- name: Commit screenshots to the OSTree repository
|
|
run: |
|
|
ostree commit --repo=repo --canonical-permissions --branch=screenshots/x86_64 flatpak_app/screenshots
|
|
|
|
- name: Publish to Flathub Beta
|
|
uses: bilelmoussaoui/flatpak-github-actions/flat-manager@v4
|
|
if: matrix.branch == 'beta'
|
|
with:
|
|
flat-manager-url: https://hub.flathub.org/
|
|
repository: beta
|
|
token: ${{ secrets.FLATHUB_BETA_TOKEN }}
|
|
|
|
- name: Publish to Flathub
|
|
uses: bilelmoussaoui/flatpak-github-actions/flat-manager@v4
|
|
if: matrix.branch == 'stable'
|
|
with:
|
|
flat-manager-url: https://hub.flathub.org/
|
|
repository: stable
|
|
token: ${{ secrets.FLATHUB_TOKEN }}
|