generated from PlazmaMC/Volt
-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (112 loc) · 4.07 KB
/
upstream.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
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Always Up To Date
on:
workflow_dispatch:
schedule:
- cron: "*/20 * * * *"
jobs:
prepare:
name: Prepare Actions
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
require: ${{ steps.require.outputs.require }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: base
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
- name: Determine if update is required
id: require
run: |
REQUIRE=$(./gradlew -q checkNeedsUpdate)
echo "$REQUIRE."
echo "require=$REQUIRE" >> $GITHUB_OUTPUT
- name: Pull Branches
if: steps.require.outputs.require == 'false'
id: matrix
run: |
respond=$(curl --silent https://api.github.com/repos/plazmamc/thunderbolt/branches | jq -rc 'del(.[]|.protected) | del(.[]|.commit)')
flavor=$(echo $respond | jq -rc 'map(select(.name | test("feat/.*")) | .flavor = .name | del(.name))')
echo "matrix={\"include\":$(echo "$base $flavor" | jq -sc add)}" >> $GITHUB_OUTPUT
upstream:
name: Update Base Upstream
needs: prepare
runs-on: ubuntu-latest
if: needs.prepare.outputs.require == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: base
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
- name: Configure Git
run: git config --global user.email "[email protected]" && git config --global user.name "Github Action"
- name: Update upstream
run: ./gradlew updateUpstream
- name: Apply patches
run: ./gradlew applyPatches
- name: Check build
run: ./gradlew build
- name: Commit changes
run: git add . && printf "Updated Upstream (Plazma)\n\nUpstream has released updates that appear to apply and compile correctly\n\n$(cat compare.txt)" | git commit -F -
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
flavor:
name: Update Flavors Upstream
needs: prepare
if: needs.prepare.outputs.require == 'false'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ matrix.flavor }}
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 21
- name: Determine if update is required
id: check
run: echo "needs=$(./gradlew -q checkNeedsUpdate)" >> $GITHUB_OUTPUT
- name: Configure Git
if: steps.check.outputs.needs == 'true'
run: git config --global user.email "[email protected]" && git config --global user.name "Github Action"
- name: Update upstream
if: steps.check.outputs.needs == 'true'
run: ./gradlew updateUpstream
- name: Apply patches
if: steps.check.outputs.needs == 'true'
run: ./gradlew applyPatches
- name: Check build
if: steps.check.outputs.needs == 'true'
run: ./gradlew build
- name: Commit changes
if: steps.check.outputs.needs == 'true'
run: git add . && printf "Updated Upstream (Base)\n\nUpstream has released updates that appear to apply and compile correctly\n\n$(cat compare.txt)" | git commit -F -
- name: Push changes
if: steps.check.outputs.needs == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ matrix.flavor }}