-
Notifications
You must be signed in to change notification settings - Fork 2
42 lines (38 loc) · 1.61 KB
/
check-upstream-cronjob.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
name: Check upstream changes CRONJOB
on:
schedule:
- cron: '30 * * * *'
workflow_dispatch:
jobs:
get-latest-upstream-commit:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.fetch-latest-commit.outputs.sha }}
steps:
- id: fetch-latest-commit
run: |
SHA=$(curl -s -f https://api.github.com/repos/moonlight-stream/moonlight-qt/commits/master | jq -r .sha)
echo "SHA: $SHA"
echo "::set-output name=sha::$SHA"
get-edge-snap-metadata:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.fetch-edge-snap-metadata.outputs.version }}
steps:
- id: fetch-edge-snap-metadata
run: |
VERSION=$(curl -s -f -H "Snap-Device-Series: 16" "https://api.snapcraft.io/v2/snaps/info/moonlight" \
| jq -r '."channel-map"[] | select(.channel.architecture=="amd64" and .channel.track=="latest" and .channel.name=="edge") | .version' \
| grep -oP '[0-9\.]+-[0-9]+-g\K[0-9a-f]+')
echo "VERSION: $VERSION"
echo "::set-output name=version::$VERSION"
trigger-edge-build:
runs-on: ubuntu-latest
needs: [get-latest-upstream-commit, get-edge-snap-metadata]
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'schedule' && !startswith(needs.get-latest-upstream-commit.outputs.sha, needs.get-edge-snap-metadata.outputs.version))
steps:
- name: Trigger edge build
run: |
curl -f -H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/maxiberta/moonlight-snap/dispatches -d '{"event_type": "trigger-edge-build-event"}'