forked from obsproject/obs-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (107 loc) · 4.27 KB
/
flatpak.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
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 'valid_tag=true' >> $GITHUB_OUTPUT
echo 'matrix=["beta", "stable"]' >> $GITHUB_OUTPUT
;;
+([0-9]).+([0-9]).+([0-9])-@(beta|rc)*([0-9]) )
echo 'valid_tag=true' >> $GITHUB_OUTPUT
echo 'matrix=["beta"]' >> $GITHUB_OUTPUT
;;
* ) echo 'valid_tag=false' >> $GITHUB_OUTPUT ;;
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-6.4
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
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CACHE_KEY: flatpak-builder-${{ hashFiles('CI/flatpak/com.obsproject.Studio.json') }}
run: |
dnf install -y -q gh
gh extension install actions/gh-actions-cache
git config --global --add safe.directory $GITHUB_WORKSPACE
KEY="$CACHE_KEY-x86_64"
CACHE_HIT=$(gh actions-cache list -B master --key $KEY | grep -q $KEY && echo 'true' || echo 'false')
echo "git_hash=$(git rev-parse --short=9 HEAD)" >> $GITHUB_OUTPUT
echo "cache_key=$CACHE_KEY" >> $GITHUB_OUTPUT
echo "cache_hit=$CACHE_HIT" >> $GITHUB_OUTPUT
- name: Build Flatpak Manifest
uses: flatpak/flatpak-github-actions/flatpak-builder@v6.1
with:
bundle: obs-studio-${{ steps.setup.outputs.git_hash }}.flatpak
manifest-path: CI/flatpak/com.obsproject.Studio.json
cache: ${{ fromJSON(steps.setup.outputs.cache_hit) }}
cache-key: ${{ steps.setup.outputs.cache_key }}
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: flatpak/flatpak-github-actions/flat-manager@v6.1
if: matrix.branch == 'beta'
with:
flat-manager-url: https://hub.flathub.org/
repository: beta
token: ${{ secrets.FLATHUB_BETA_TOKEN }}
- name: Publish to Flathub
uses: flatpak/flatpak-github-actions/flat-manager@v6.1
if: matrix.branch == 'stable'
with:
flat-manager-url: https://hub.flathub.org/
repository: stable
token: ${{ secrets.FLATHUB_TOKEN }}