1
+ name : Poll Hyperion.NG (Pre-)releases
2
+ on :
3
+ schedule :
4
+ # Runs at 00:00 UTC everyday
5
+ - cron : ' 0 0 * * *'
6
+ workflow_dispatch :
7
+
8
+ jobs :
9
+ local_tag :
10
+ runs-on : ubuntu-latest
11
+ outputs :
12
+ tag : ${{ steps.read-tag.outputs.value }}
13
+ steps :
14
+ - uses : actions/checkout@v3
15
+ - name : Read current tag from CI workflow
16
+ id : read-tag
17
+ run : echo value=$(yq -r .jobs.build_hyperion_ng.steps[0].with.ref ./.github/workflows/build.yml) >> $GITHUB_OUTPUT
18
+ - name : Print out gathered tag
19
+ run : echo "Current tag=${{ steps.read-tag.outputs.value }}"
20
+
21
+ remote_tag :
22
+ runs-on : ubuntu-latest
23
+ outputs :
24
+ tag : ${{ steps.read-tag.outputs.value }}
25
+ steps :
26
+ - name : Checkout Hyperion.NG repo
27
+ uses : actions/checkout@v3
28
+ with :
29
+ repository : hyperion-project/hyperion.ng
30
+ submodules : recursive
31
+ fetch-depth : 0
32
+ - name : Get latest tag of Hyperion.NG
33
+ id : read-tag
34
+ run : echo value=$(git describe --tags --abbrev=0) >> $GITHUB_OUTPUT
35
+ - name : Print out gathered tag
36
+ run : echo "Current tag=${{ steps.read-tag.outputs.value }}"
37
+
38
+ create_pull_request :
39
+ runs-on : ubuntu-latest
40
+ needs : [local_tag, remote_tag]
41
+ if : ${{ needs.local_tag.outputs.tag != needs.remote_tag.outputs.tag }}
42
+ steps :
43
+ - name : Assemble PR branch name
44
+ run : echo "pr_branch=update_daemon/${{ needs.remote_tag.outputs.tag }}" >> $GITHUB_ENV
45
+ - name : Check if PR already exists by attempting to checkout branch
46
+ continue-on-error : true
47
+ uses : actions/checkout@v3
48
+ with :
49
+ ref : ${{ env.pr_branch }}
50
+ - name : Check if PR branch cloned
51
+ run : |
52
+ sh -c 'if [[ -f package.json ]]; then echo "PR already exists"; exit 1; fi'
53
+ - name : Clone master branch
54
+ uses : actions/checkout@v3
55
+ with :
56
+ ref : master
57
+ fetch-depth : 0
58
+ - name : Inject latest tag into CI workflow file
59
+ run : sed -i 's/${{ needs.local_tag.outputs.tag }}/${{ needs.remote_tag.outputs.tag }}/' ./.github/workflows/build.yml
60
+ - name : Create Pull Request
61
+ uses : peter-evans/create-pull-request@v4
62
+ with :
63
+ add-paths : .github/workflows/build.yml
64
+ title : " [Daemon] Bump Hyperion.NG to ${{ needs.remote_tag.outputs.tag }}"
65
+ commit-message : " [Daemon] Bump Hyperion.NG to ${{ needs.remote_tag.outputs.tag }}"
66
+ branch : ${{ env.pr_branch }}
67
+ delete-branch : true
68
+
0 commit comments