-
Notifications
You must be signed in to change notification settings - Fork 775
379 lines (340 loc) · 14.9 KB
/
build-kernel-release.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
name: Build and Release GKI Kernels
permissions:
contents: write # Allow writing to repository contents (for pushing tags)
actions: write # Allows triggering actions
on:
workflow_dispatch:
inputs:
make_release:
description: 'Do you want to create a release?'
required: true
type: boolean
default: true
runner:
description: "Choose runner"
required: true
type: choice
options:
- ubuntu-22.04
- ubuntu-22.04-local
default: ubuntu-22.04
lto_type:
description: "Choose LTO type (full will not run on basic runners)"
required: true
type: choice
options:
- full
- thin
- none
default: thin
kernelsu_variant:
description: "Choose KernelSU"
required: true
type: choice
options:
- Official
- Next
- MKSU
default: Next
kernelsu_branch:
description: "Choose ksu branch"
required: true
type: choice
options:
- Stable
- Dev
- Other
default: Stable
kernelsu_branch_other:
description: "If 'Other' is selected, specify your custom branch"
required: false
type: string # This input is required if 'Other' is chosen
default: "" # Default is empty, but can be filled in if 'Other' is selected
jobs:
build-kernel-a12-5-10:
uses: ./.github/workflows/kernel-a12-5.10.yml
secrets: inherit
with:
runner: ${{ inputs.runner }}
lto_type: ${{ inputs.lto_type }}
kernelsu_variant: ${{ inputs.kernelsu_variant }}
kernelsu_branch: ${{ inputs.kernelsu_branch }}
kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
build-kernel-a13-5-10:
uses: ./.github/workflows/kernel-a13-5.10.yml
secrets: inherit
with:
runner: ${{ inputs.runner }}
lto_type: ${{ inputs.lto_type }}
kernelsu_variant: ${{ inputs.kernelsu_variant }}
kernelsu_branch: ${{ inputs.kernelsu_branch }}
kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
build-kernel-a13-5-15:
uses: ./.github/workflows/kernel-a13-5.15.yml
secrets: inherit
with:
runner: ${{ inputs.runner }}
lto_type: ${{ inputs.lto_type }}
kernelsu_variant: ${{ inputs.kernelsu_variant }}
kernelsu_branch: ${{ inputs.kernelsu_branch }}
kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
build-kernel-a14-5-15:
uses: ./.github/workflows/kernel-a14-5.15.yml
secrets: inherit
with:
runner: ${{ inputs.runner }}
lto_type: ${{ inputs.lto_type }}
kernelsu_variant: ${{ inputs.kernelsu_variant }}
kernelsu_branch: ${{ inputs.kernelsu_branch }}
kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
build-kernel-a14-6-1:
uses: ./.github/workflows/kernel-a14-6.1.yml
secrets: inherit
with:
runner: ${{ inputs.runner }}
lto_type: ${{ inputs.lto_type }}
kernelsu_variant: ${{ inputs.kernelsu_variant }}
kernelsu_branch: ${{ inputs.kernelsu_branch }}
kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
build-kernel-a15-6-6:
uses: ./.github/workflows/kernel-a15-6.6.yml
secrets: inherit
with:
runner: ${{ inputs.runner }}
lto_type: ${{ inputs.lto_type }}
kernelsu_variant: ${{ inputs.kernelsu_variant }}
kernelsu_branch: ${{ inputs.kernelsu_branch }}
kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
build-kernel-wsa:
uses: ./.github/workflows/kernel-wsa.yml
secrets: inherit
with:
runner: ${{ inputs.runner }}
kernelsu_variant: ${{ inputs.kernelsu_variant }}
kernelsu_branch: ${{ inputs.kernelsu_branch }}
kernelsu_branch_other: ${{ inputs.kernelsu_branch_other }}
trigger-release:
runs-on: ubuntu-latest
needs:
- build-kernel-a12-5-10
- build-kernel-a13-5-10
- build-kernel-a13-5-15
- build-kernel-a14-5-15
- build-kernel-a14-6-1
- build-kernel-a15-6-6
- build-kernel-wsa
if: ${{ inputs.make_release }}
env:
REPO_OWNER: WildPlusKernel
REPO_NAME: GKI_KernelSU_SUSFS
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_NAME: "*TEST BUILD* GKI Kernels With KernelSU-${{ inputs.kernelsu_variant }} ${{ inputs.kernelsu_branch }} & SUSFS v1.5.5 *TEST BUILD*"
RELEASE_NOTES: |
This release contains KernelSU-${{ inputs.kernelsu_variant }} ${{ inputs.kernelsu_branch }} and SUSFS v1.5.5
Features:
-> KernelSU-${{ inputs.kernelsu_variant }}-${{ inputs.kernelsu_branch }}
-> SUSFS ඞ v1.5.5
-> Wireguard Support
-> Simple Maphide for LineageOS Detections
-> Futile Maphide for jit-zygote-cache Detections
-> Magic Mount Support
Module:
-> https://github.com/sidex15/ksu_module_susfs
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v3
- name: Determine the branch for KernelSU-${{ inputs.kernelsu_variant }}
if: ${{ inputs.kernelsu_branch == 'Dev' || inputs.kernelsu_variant == 'MKSU' }}
run: |
# Determine the branch based on user input
if [[ "${{ inputs.kernelsu_variant }}" == "Official" || "${{ inputs.kernelsu_variant }}" == "MKSU" ]]; then
BRANCH="main"
elif [[ "${{ inputs.kernelsu_variant }}" == "Next" ]]; then
BRANCH="next"
elif [[ "${{ inputs.kernelsu_branch }}" == "Other" && -n "${{ inputs.kernelsu_branch_other }}" ]]; then
BRANCH="${{ inputs.kernelsu_branch_other }}"
else
echo "Error: Custom branch not provided for 'Other'" >&2
exit 1
fi
# Store the selected branch in GITHUB_ENV
echo "KSU_BRANCH=$BRANCH" >> $GITHUB_ENV
- name: Get commit hash or tag and generate URL for KernelSU-${{ inputs.kernelsu_variant }}
run: |
if [ "${{ inputs.kernelsu_variant }}" == "Official" ]; then
echo "This is the Official variant"
REPO_URL="https://github.com/tiann/KernelSU.git"
REPO_URL2="tiann/KernelSU"
elif [ "${{ inputs.kernelsu_variant }}" == "Next" ]; then
echo "This is the Next variant"
REPO_URL="https://github.com/rifsxd/KernelSU-Next.git"
REPO_URL2="rifsxd/KernelSU-Next"
elif [ "${{ inputs.kernelsu_variant }}" == "MKSU" ]; then
echo "This is the MKSU variant"
REPO_URL="https://github.com/5ec1cff/KernelSU.git"
REPO_URL2="5ec1cff/KernelSU"
else
echo "Unknown variant"
fi
if [[ "${{ inputs.kernelsu_branch }}" == "Stable" && "${{ inputs.kernelsu_variant }}" != "MKSU" ]]; then
# Fetch the latest tag
TAG=$(git ls-remote --tags --sort=-v:refname $REPO_URL | grep -o 'refs/tags/.*' | cut -d'/' -f3 | head -n1)
if [[ -z "$TAG" ]]; then
echo "Error: Could not fetch latest tag for Stable" >&2
exit 1
fi
KSU_REF=$TAG
KSU_URL="https://github.com/$REPO_URL2/releases/tag/$TAG"
elif [[ "${{ inputs.kernelsu_branch }}" == "Dev" || "${{ inputs.kernelsu_variant }}" == "MKSU" ]]; then
# Fetch the latest commit from "next" branch
COMMIT_HASH=$(git ls-remote $REPO_URL refs/heads/$KSU_BRANCH | awk '{ print $1 }')
if [[ -z "$COMMIT_HASH" ]]; then
echo "Error: Could not fetch latest commit for Dev" >&2
exit 1
fi
KSU_REF=$COMMIT_HASH
KSU_URL="https://github.com/$REPO_URL2/commit/$COMMIT_HASH"
else
# Fetch the specific tag
TAG=${{ inputs.kernelsu_branch_other }}
if git ls-remote --tags $REPO_URL | grep -q "refs/tags/$TAG"; then
KSU_REF=$TAG
KSU_URL="https://github.com/$REPO_URL2/releases/tag/$TAG"
else
echo "Error: Specified tag '$TAG' not found in KernelSU-Next" >&2
exit 1
fi
fi
# Echo the values to GitHub environment for later use
echo "KSU_REF=$KSU_REF" >> $GITHUB_ENV
echo "KSU_URL=$KSU_URL" >> $GITHUB_ENV
echo "KernelSU Reference: $KSU_REF"
echo "KernelSU URL: $KSU_URL"
- name: Get commit hashes and generate commit URLs
run: |
GITLAB_OWNER="simonpunk"
GITLAB_REPO="susfs4ksu"
declare -A BRANCH_MAP=(
["gki_android12_5_10"]="gki-android12-5.10"
["gki_android13_5_10"]="gki-android13-5.10"
["gki_android13_5_15"]="gki-android13-5.15"
["gki_android14_5_15"]="gki-android14-5.15"
["gki_android14_6_1"]="gki-android14-6.1"
)
for var_name in "${!BRANCH_MAP[@]}"; do
branch_name="${BRANCH_MAP[$var_name]}"
COMMIT_HASH=$(git ls-remote https://gitlab.com/$GITLAB_OWNER/$GITLAB_REPO.git refs/heads/$branch_name | awk '{ print $1 }')
if [[ -n "$COMMIT_HASH" ]]; then
COMMIT_URL="https://gitlab.com/$GITLAB_OWNER/$GITLAB_REPO/-/commit/$COMMIT_HASH"
echo "$branch_name Commit: $COMMIT_HASH"
echo "$branch_name Commit URL: $COMMIT_URL"
# Store commit hash and commit URL in GitHub environment
echo "COMMIT_HASH_${var_name}=$COMMIT_HASH" >> "$GITHUB_ENV"
echo "COMMIT_URL_${var_name}=$COMMIT_URL" >> "$GITHUB_ENV"
fi
done
- name: Append Commit Hashes & Links to `RELEASE_NOTES` & Append KernelSU-Next Reference to `RELEASE_NOTES`
run: |
if [ "${{ inputs.kernelsu_variant }}" == "Official" ]; then
echo "This is the Official variant"
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "$RELEASE_NOTES" >> $GITHUB_ENV
echo "Official Manager:" >> $GITHUB_ENV
echo "-> https://github.com/tiann/KernelSU" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
elif [ "${{ inputs.kernelsu_variant }}" == "Next" ]; then
echo "This is the Next variant"
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "$RELEASE_NOTES" >> $GITHUB_ENV
echo "Next Manager:" >> $GITHUB_ENV
echo "-> https://github.com/rifsxd/KernelSU-Next" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
elif [ "${{ inputs.kernelsu_variant }}" == "MKSU" ]; then
echo "This is the MKSU variant"
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "$RELEASE_NOTES" >> $GITHUB_ENV
echo "MKSU Manager:" >> $GITHUB_ENV
echo "-> https://github.com/5ec1cff/KernelSU" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
else
echo "Unknown variant"
fi
- name: Append Commit Hashes & Links to `RELEASE_NOTES` & Append KernelSU-Next Reference to `RELEASE_NOTES`
run: |
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "$RELEASE_NOTES" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "LTO: ${{ inputs.lto_type }}" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "Commit Hashes and Links:" >> $GITHUB_ENV
echo "KernelSU:" >> $GITHUB_ENV
echo "${{ inputs.kernelsu_variant }}-${{ inputs.kernelsu_branch }}: [$KSU_REF]($KSU_URL)" >> $GITHUB_ENV
echo "SUSFS4KSU:" >> $GITHUB_ENV
echo "gki-android12-5.10: [$COMMIT_HASH_gki_android12_5_10]($COMMIT_URL_gki_android12_5_10)" >> $GITHUB_ENV
echo "gki-android13-5.10: [$COMMIT_HASH_gki_android13_5_10]($COMMIT_URL_gki_android13_5_10)" >> $GITHUB_ENV
echo "gki-android13-5.15: [$COMMIT_HASH_gki_android13_5_15]($COMMIT_URL_gki_android13_5_15)" >> $GITHUB_ENV
echo "gki-android14-5.15: [$COMMIT_HASH_gki_android14_5_15]($COMMIT_URL_gki_android14_5_15)" >> $GITHUB_ENV
echo "gki-android14-6.1: [$COMMIT_HASH_gki_android14_6_1]($COMMIT_URL_gki_android14_6_1)" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
# Get the Latest Tag from GitHub
- name: Generate and Create New Tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Fetch the latest tag from GitHub (this is the latest tag based on the GitHub API)
LATEST_TAG=$(gh api repos/$REPO_OWNER/$REPO_NAME/tags --jq '.[0].name')
if [ -z "$LATEST_TAG" ]; then
LATEST_TAG="v1.5.5-r0"
fi
NEW_TAG=$(echo "$LATEST_TAG" | awk -F'-r' '{suffix=$2; if (!suffix) suffix=0; suffix++; printf "%s-r%d", $1, suffix}')
# Output the new tag to be used
echo "New tag: $NEW_TAG"
# Set the new tag as an environment variable to be used in later steps
echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_ENV
# Create the tag in the repository
git tag $NEW_TAG
git push --tags
# Download Artifacts for A12 (Only if A12 Build is successful or input is true or empty)
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: ./downloaded-artifacts
# Create GitHub Release and upload files if make_release is true
- name: Create GitHub Release
uses: actions/create-release@v1
with:
tag_name: ${{ env.NEW_TAG }} # Use the generated tag for the release
prerelease: true # Mark the release as a pre-release
release_name: ${{ env.RELEASE_NAME }} # Pass the RELEASE_NAME to the action
body: ${{ env.RELEASE_NOTES }} # Pass the RELEASE_NOTES to the action
- name: Upload Release Assets Dynamically
run: |
# Loop through all files in the downloaded-artifacts directory
for file in ./downloaded-artifacts/kernel-*/*; do
# Skip directories
if [ -d "$file" ]; then
continue
fi
# Upload the file to the GitHub release
echo "Uploading $file..."
gh release upload ${{ env.NEW_TAG }} "$file"
done
# Display Files Uploaded
- name: Display Files Uploaded
run: |
echo "GitHub release created with the following files:"
ls ./downloaded-artifacts/**/*
- name: send telegram message on push
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TELEGRAM_MESSAGE_THREAD_ID: ${{ secrets.TELEGRAM_MESSAGE_THREAD_ID }}
run: |
curl -X POST "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" \
-d "chat_id=$TELEGRAM_CHAT_ID" \
-d "message_thread_id=$TELEGRAM_MESSAGE_THREAD_ID" \
-d "text=Latest release:
https://github.com/WildPlusKernel/GKI_KernelSU_SUSFS/releases/tag/${{ env.NEW_TAG }}
${{ env.RELEASE_NOTES }}"