flatpak.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. ---
  2. name: Flatpak
  3. on:
  4. release:
  5. types: [published]
  6. branches: [master, 'release/**']
  7. env:
  8. TWITCH_CLIENTID: ${{ secrets.TWITCH_CLIENT_ID }}
  9. TWITCH_HASH: ${{ secrets.TWITCH_HASH }}
  10. RESTREAM_CLIENTID: ${{ secrets.RESTREAM_CLIENTID }}
  11. RESTREAM_HASH: ${{ secrets.RESTREAM_HASH }}
  12. YOUTUBE_CLIENTID: ${{ secrets.YOUTUBE_CLIENTID }}
  13. YOUTUBE_CLIENTID_HASH: ${{ secrets.YOUTUBE_CLIENTID_HASH }}
  14. YOUTUBE_SECRET: ${{ secrets.YOUTUBE_SECRET }}
  15. YOUTUBE_SECRET_HASH: ${{ secrets.YOUTUBE_SECRET_HASH }}
  16. jobs:
  17. check_tag:
  18. name: Check release tag
  19. runs-on: [ubuntu-latest]
  20. outputs:
  21. valid_tag: ${{ steps.check_tag.outputs.valid_tag }}
  22. matrix: ${{ steps.check_tag.outputs.matrix }}
  23. steps:
  24. - name: Check the tag
  25. id: check_tag
  26. run: |
  27. shopt -s extglob
  28. case ${GITHUB_REF##*/} in
  29. +([0-9]).+([0-9]).+([0-9]) )
  30. echo 'valid_tag=true' >> $GITHUB_OUTPUT
  31. echo 'matrix=["beta", "stable"]' >> $GITHUB_OUTPUT
  32. ;;
  33. +([0-9]).+([0-9]).+([0-9])-@(beta|rc)*([0-9]) )
  34. echo 'valid_tag=true' >> $GITHUB_OUTPUT
  35. echo 'matrix=["beta"]' >> $GITHUB_OUTPUT
  36. ;;
  37. * ) echo 'valid_tag=false' >> $GITHUB_OUTPUT ;;
  38. esac
  39. publish:
  40. name: Publish to Flathub
  41. runs-on: [ubuntu-latest]
  42. needs: check_tag
  43. if: fromJSON(needs.check_tag.outputs.valid_tag)
  44. env:
  45. FLATPAK_BUILD_PATH: flatpak_app/files/share
  46. container:
  47. image: bilelmoussaoui/flatpak-github-actions:kde-6.4
  48. options: --privileged
  49. strategy:
  50. matrix:
  51. branch: ${{ fromJSON(needs.check_tag.outputs.matrix) }}
  52. steps:
  53. - name: Checkout
  54. uses: actions/checkout@v3
  55. with:
  56. submodules: 'recursive'
  57. - name: 'Setup build environment'
  58. id: setup
  59. env:
  60. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  61. CACHE_KEY: flatpak-builder-${{ hashFiles('build-aux/**/*.json') }}
  62. run: |
  63. dnf install -y -q gh
  64. gh extension install actions/gh-actions-cache
  65. git config --global --add safe.directory $GITHUB_WORKSPACE
  66. KEY="$CACHE_KEY-x86_64"
  67. CACHE_HIT=$(gh actions-cache list -B master --key $KEY | grep -q $KEY && echo 'true' || echo 'false')
  68. echo "git_hash=$(git rev-parse --short=9 HEAD)" >> $GITHUB_OUTPUT
  69. echo "cache_key=$CACHE_KEY" >> $GITHUB_OUTPUT
  70. echo "cache_hit=$CACHE_HIT" >> $GITHUB_OUTPUT
  71. - name: Build Flatpak Manifest
  72. uses: flatpak/flatpak-github-actions/[email protected]
  73. with:
  74. bundle: obs-studio-${{ steps.setup.outputs.git_hash }}.flatpak
  75. manifest-path: build-aux/com.obsproject.Studio.json
  76. cache: ${{ fromJSON(steps.setup.outputs.cache_hit) }}
  77. cache-key: ${{ steps.setup.outputs.cache_key }}
  78. mirror-screenshots-url: https://dl.flathub.org/repo/screenshots
  79. branch: ${{ matrix.branch }}
  80. - name: Validate AppStream
  81. shell: bash
  82. working-directory: ${{ env.FLATPAK_BUILD_PATH }}
  83. run: |
  84. appstream-util validate appdata/com.obsproject.Studio.appdata.xml
  85. - name: Verify icon and metadata in app-info
  86. shell: bash
  87. working-directory: ${{ env.FLATPAK_BUILD_PATH }}
  88. run: |
  89. test -f app-info/icons/flatpak/128x128/com.obsproject.Studio.png || { echo "Missing 128x128 icon in app-info" ; exit 1; }
  90. test -f app-info/xmls/com.obsproject.Studio.xml.gz || { echo "Missing com.obsproject.Studio.xml.gz in app-info" ; exit 1; }
  91. - name: Commit screenshots to the OSTree repository
  92. run: |
  93. ostree commit --repo=repo --canonical-permissions --branch=screenshots/x86_64 flatpak_app/screenshots
  94. - name: Publish to Flathub Beta
  95. uses: flatpak/flatpak-github-actions/[email protected]
  96. if: matrix.branch == 'beta'
  97. with:
  98. flat-manager-url: https://hub.flathub.org/
  99. repository: beta
  100. token: ${{ secrets.FLATHUB_BETA_TOKEN }}
  101. - name: Publish to Flathub
  102. uses: flatpak/flatpak-github-actions/[email protected]
  103. if: matrix.branch == 'stable'
  104. with:
  105. flat-manager-url: https://hub.flathub.org/
  106. repository: stable
  107. token: ${{ secrets.FLATHUB_TOKEN }}