-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (49 loc) · 1.84 KB
/
receiver.yaml
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
name: "📥 Receive Dispatch Events"
run-name: "Received dispatch from ${{ github.event.client_payload.package }} for ${{ github.event.client_payload.version }}"
on:
repository_dispatch:
types:
- web-dispatch
- server-dispatch
# sample payload:
# {
# "branch": "master",
# "package": "server",
# "version": "...",
# "git_sha": "..."
# }
concurrency:
group: ${{ github.workflow }}-${{ github.event.client_payload.branch }}
permissions: {}
env:
TARGET_BRANCH: ${{ github.event.client_payload.branch }}
PACKAGE: ${{ github.event.client_payload.package }}
VERSION: ${{ github.event.client_payload.version }}
GIT_SHA: ${{ github.event.client_payload.git_sha }}
jobs:
handleRecived:
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
uses: actions/checkout@v3
with:
# needed since the regular GH token cannot not trigger CI when committing back
token: ${{ secrets.JF_BOT_TOKEN }}
# check if branch exists and branch of master if not
- name: "Handle Branching"
if: ${{ contains(github.event.client_payload.branch, 'release') }}
run: |-
if git ls-remote --exit-code --heads origin "${TARGET_BRANCH}"; then
echo "INFO: Creating new branch ${TARGET_BRANCH}"
git checkout -b "${TARGET_BRANCH}"
fi
- name: "Bump Version for ${{ env.PACKAGE }} to ${{ env.VERSION }}"
run: yq '.version = env(VERSION) | .git_sha = env(GIT_SHA)' -i ${PACKAGE}/metaValues.yaml
- name: "Commit and Push Changes"
run: |-
set -exu
git config user.name "jellyfin-bot"
git config user.email "[email protected]"
git add ${PACKAGE}/metaValues.yaml
git commit -m "bump ${PACKAGE} version to ${VERSION}"
git push origin "HEAD:refs/heads/${TARGET_BRANCH}"