forked from flathub/flathub
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (62 loc) · 2.18 KB
/
trigger-flathub-build.yml
File metadata and controls
68 lines (62 loc) · 2.18 KB
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
name: Trigger Flathub Build
run-name: Build of ${{ inputs.flatpak_id }} from ref ${{ inputs.git_branch }}
on:
workflow_dispatch:
inputs:
git_branch:
description: 'Git branch to build'
required: true
default: 'master'
flatpak_id:
description: 'Flatpak ID'
required: true
force_test:
description: 'Force test build on master'
required: true
default: 'false'
type: choice
options:
- 'true'
- 'false'
env:
API_URL: https://flathub-vorarbeiter.apps.openshift.gnome.org/api/pipelines
FLATPAK_ID: ${{ github.event.inputs.flatpak_id }}
GIT_BRANCH: ${{ github.event.inputs.git_branch }}
FORCE_TEST: ${{ github.event.inputs.force_test }}
GITHUB_URL: https://github.com/flathub
jobs:
build:
permissions: {}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check for existence of repo and branch
run: |
git -c credential.interactive=false ls-remote --heads --exit-code \
"$GITHUB_URL"/"$FLATPAK_ID".git "$GIT_BRANCH"
- name: Print information
shell: bash
run: |
if [ "$FORCE_TEST" == "true" ]; then
echo -e "\n\n"
echo "Triggering test build from master branch of $FLATPAK_ID"
elif [ "$GIT_BRANCH" == "master" ] || [ "$GIT_BRANCH" == "beta" ] || [[ "$GIT_BRANCH" == branch/* ]]; then
echo -e "\n\n"
echo "Triggering official build from $GIT_BRANCH branch of $FLATPAK_ID"
else
echo -e "\n\n"
echo "Triggering test build from $GIT_BRANCH of $FLATPAK_ID"
fi
- name: Trigger build
run: |
if [ "$FORCE_TEST" == "true" ]; then
JSON_PAYLOAD="{\"app_id\": \"$FLATPAK_ID\", \"params\": {}}"
else
JSON_PAYLOAD="{\"app_id\": \"$FLATPAK_ID\", \"params\": {\"ref\": \"refs/heads/$GIT_BRANCH\"}}"
fi
curl -X POST "$API_URL" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD"
env:
TOKEN: ${{ secrets.VORO_AUTH_TOKEN }}