forked from MustardChef/WSABuilds
-
Notifications
You must be signed in to change notification settings - Fork 0
288 lines (265 loc) · 14 KB
/
Copy pathbuild.yaml
File metadata and controls
288 lines (265 loc) · 14 KB
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
name: Build MagiskOnWSA
on:
workflow_dispatch:
inputs:
arch:
description: "WSA Architecture"
required: true
default: "x86_64"
type: choice
options:
- x86_64
- ARM64
release_type:
description: "WSA Release Channel"
required: true
default: "Dev Channel"
type: choice
options:
- General Availability Channel
- Release Preview Channel
- Beta Channel
- Dev Channel
magisk_ver:
description: "Magisk Version"
required: true
default: "Stable"
type: choice
options:
- None
- Stable
- Beta
- Canary
- Debug
- Custom
magisk_url:
description: "Custom Magisk APK/ZIP URL"
required: false
type: string
gapps_var:
description: "GApps Variant"
required: true
default: "MindTheGapps"
type: choice
options:
- None
- Pico
- Full
- MindTheGapps
- Custom (OpenGApps)
- Custom (MindTheGapps)
gapps_url:
description: "Custom GApps ZIP URL"
required: false
type: string
remove_amazon:
description: "Remove Amazon AppStore"
required: true
default: true
type: boolean
# nofix_props:
# description: Props Remain Unfixed
# required: true
# default: false
# type: boolean
# skip_download_wsa:
# description: Skip WSA Download
# required: true
# default: false
# type: boolean
compression:
description: "Compression Algorithm"
required: true
default: "ZIP"
type: choice
options:
- ZIP
- 7-Zip
- XZ
tag:
description: "Release Tag Name"
required: true
default: "WSA"
type: string
prerelease:
description: "Release as Prerelease"
required: false
default: false
type: boolean
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Dependencies
working-directory: ./scripts
run: |
sudo apt update && sudo apt -y install setools lzip wine winetricks patchelf e2fsprogs python3-pip aria2 p7zip-full attr xz-utils unzip
python3 -m pip install requests
cp -r ../wine/.cache/* ~/.cache
winetricks msxml6
- name: Build MagiskOnWSA
working-directory: ./scripts
run: |
DOWNLOAD_DIR=../download
DOWNLOAD_CONF_NAME=download.list
mkdir -p "$DOWNLOAD_DIR"
declare -A opts=( ["ARCH,x86_64"]="x64" ["ARCH,ARM64"]="arm64" ["RELEASE_TYPE,General Availability Channel"]="retail" ["RELEASE_TYPE,Release Preview Channel"]="RP" ["RELEASE_TYPE,Beta Channel"]="WIS" ["RELEASE_TYPE,Dev Channel"]="WIF" ["MAGISK_VER,Stable"]="stable" ["MAGISK_VER,Beta"]="beta" ["MAGISK_VER,Canary"]="canary" ["MAGISK_VER,Debug"]="debug" ["MAGISK_VER,Custom"]="--magisk-custom" ["GAPPS_VAR,None"]="none" ["GAPPS_VAR,Pico"]="pico" ["GAPPS_VAR,Full"]="full" ["REMOVE_AMAZON,true"]="--remove-amazon" ["NOFIX_PROPS,true"]="--nofix-props" ["SKIP_DOWNLOAD_WSA,true"]="--skip-download-wsa" ["COMPRESSION,ZIP"]="zip" ["COMPRESSION,7-Zip"]="7z" ["COMPRESSION,XZ"]="xz" )
ARCH="${opts[ARCH,${{ inputs.arch }}]}"
RELEASE_TYPE="${opts[RELEASE_TYPE,${{ inputs.release_type }}]}"
if [[ "${{ inputs.magisk_ver }}" != "None" ]]; then
ROOT_SOL="magisk"
if [[ "${{ inputs.magisk_ver }}" != "Custom" ]]; then
MAGISK_VER="${opts[MAGISK_VER,${{ inputs.magisk_ver }}]}"
else
echo -e "${{ inputs.magisk_url }}\n out=magisk-debug.zip" > "$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_custom_magisk_download.log" -x16 -s16 -j5 -c -R -m0 --async-dns=false --check-integrity --continue --allow-overwrite --conditional-get -d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"; then
echo "Magisk download error!"
exit 1
fi
CUSTOM_MAGISK="${opts[MAGISK_VER,Custom]}"
MAGISK_VER="${opts[MAGISK_VER,Debug]}"
fi
else
ROOT_SOL="none"
MAGISK_VER="${opts[MAGISK_VER,Stable]}"
fi
if [[ "${{ inputs.arch }}" == "x86_64" ]]; then
GAPPS_VAR="${opts[GAPPS_VAR,${{ inputs.gapps_var }}]}"
else
# TODO: keep it 11.0 since official opengapps does not support 12+ yet
# As soon as opengapps is available for 12+, we need to get the sdk/release from build.prop and download the corresponding version
if [[ "${{ inputs.gapps_var }}" != "None" ]]; then
GAPPS_VAR="${opts[GAPPS_VAR,Pico]}"
else
GAPPS_VAR="${opts[GAPPS_VAR,${{ inputs.gapps_var }}]}"
fi
fi
if [[ "${{ inputs.gapps_var }}" != "None" ]]; then
if [[ "${{ inputs.gapps_var }}" != *"MindTheGapps"* ]]; then
GAPPS_BRAND="OpenGApps"
if [[ "${{ inputs.gapps_var }}" == "Custom (OpenGApps)" ]]; then
if [[ -z "${${{ inputs.gapps_url }}+x}" ]]; then
GAPPS_VARIANT_MAP=(
"super"
"stock"
"full"
"mini"
"micro"
"nano"
"pico"
"tvstock"
"tvmini"
)
for file in "$DOWNLOAD_DIR"/OpenGApps-"$ARCH"-*.zip; do
GAPPS_VAR=${file%%\.*}
GAPPS_VAR=${GAPPS_VAR##*-}
list_count=${#GAPPS_VARIANT_MAP[@]}
for i in "${GAPPS_VARIANT_MAP[@]}"; do
if [[ "$GAPPS_VAR" == "$i" ]]; then
echo "INFO: GApps Variant: $GAPPS_VAR"
valid_gapps_var="true"
break
fi
((list_count--))
if (("$list_count" <= 0)); then
echo "Invalid GApps Variant: $GAPPS_VAR"
fi
done
if [[ "$valid_gapps_var" == "true" ]]; then
break
fi
done
if [[ "$valid_gapps_var" != "true" ]]; then
echo "Missing OpenGApps file!"
exit 1
fi
echo "opengapps_var=${GAPPS_VAR^}" >> $GITHUB_ENV
else
GAPPS_VAR="pico"
echo -e "${{ inputs.gapps_url }}\n out=OpenGApps-"$ARCH"-"$GAPPS_VAR".zip" > -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_gapps_download.log" -x16 -s16 -j5 -c -R -m0 --async-dns=false --check-integrity --continue --allow-overwrite --conditional-get -d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"; then
echo "OpenGApps download error!"
exit 1
fi
echo "opengapps_var=custom" >> $GITHUB_ENV
fi
fi
else
GAPPS_VAR="pico"
GAPPS_BRAND="MindTheGapps"
if [[ "${{ inputs.gapps_var }}" == "Custom (MindTheGapps)" ]]; then
if [[ -n "${${{ inputs.gapps_url }}+x}" ]]; then
echo -e "${{ inputs.gapps_url }}\n out=MindTheGapps-"$ARCH".zip" > -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_gapps_download.log" -x16 -s16 -j5 -c -R -m0 --async-dns=false --check-integrity --continue --allow-overwrite --conditional-get -d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"; then
echo "MindTheGapps download error!"
exit 1
fi
fi
fi
fi
else
GAPPS_VAR="pico"
GAPPS_BRAND="none"
fi
REMOVE_AMAZON="${opts[REMOVE_AMAZON,${{ inputs.remove_amazon }}]}"
NOFIX_PROPS="${opts[NOFIX_PROPS,${{ inputs.nofix_props }}]}"
SKIP_DOWNLOAD_WSA="${opts[SKIP_DOWNLOAD_WSA,${{ inputs.skip_download_wsa }}]}"
COMPRESSION="--compress --compress-format ${opts[COMPRESSION,${{ inputs.compression }}]}"
if [[ "${{ inputs.gapps_var }}" == "Custom"* ]]; then
echo "Generate Download Links"
python3 generateWSALinks.py "$ARCH" "$RELEASE_TYPE" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME"
if [[ "${{ inputs.magisk_ver }}" != "Custom" ]]; then
python3 generateMagiskLink.py "$MAGISK_VER" "$DOWNLOAD_DIR" "$DOWNLOAD_CONF_NAME"
fi
echo "Download Artifacts"
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_download.log" -x16 -s16 -j5 -c -R -m0 --async-dns=false --check-integrity --continue --allow-overwrite --conditional-get -d"$DOWNLOAD_DIR" -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"; then
echo "Artifact download error!"
exit 1
fi
OFFLINE="--offline"
fi
COMMAND_LINE=(--arch "$ARCH" --release-type "$RELEASE_TYPE" --root-sol "$ROOT_SOL" --magisk-ver "$MAGISK_VER" "$CUSTOM_MAGISK" --gapps-brand "$GAPPS_BRAND" --gapps-variant "$GAPPS_VAR" "$COMPRESSION" "$REMOVE_AMAZON" "$NOFIX_PROPS" "$SKIP_DOWNLOAD_WSA" "$OFFLINE")
echo "COMMAND_LINE=${COMMAND_LINE[*]}"
chmod +x ./build.sh
./build.sh $(echo "${COMMAND_LINE[@]}")
- name: Generate Release Asset Name
working-directory: ./output
run: |
declare -A magisk_vers=( ["Stable"]="stable" ["Beta"]="beta" ["Canary"]="canary" ["Debug"]="debug" )
if [[ "${{ inputs.magisk_ver }}" == "None" ]]; then
magiskVer=""
elif [[ "${{ inputs.magisk_ver }}" == "Custom" ]]; then
magiskVer="_Magisk-Custom"
else
magiskVer="_Magisk-${{ env.MAGISK_VERSION }}"
fi
export magiskVer
if [[ "${{ inputs.gapps_var }}" == "None" ]]; then
gappsVar=""
elif [[ "${{ inputs.gapps_var }}" == *"MindTheGapps"* ]]; then
gappsVar="_MindTheGapps"
elif [[ "${{ inputs.gapps_var }}" == "Custom (OpenGApps)" ]]; then
gappsVar="_OpenGApps-${{ env.opengapps_var }}"
else
gappsVar="_OpenGApps-${{ inputs.gapps_var }}"
fi
export gappsVar
if [[ "${{ inputs.remove_amazon }}" == "true" ]]; then
amazon=""
else
amazon="_Amazon-AppStore"
fi
export amazon
echo "release_asset_name=WSA_${{ env.WSA_VER }}_${{ inputs.arch }}$magiskVer$gappsVar${amazon}" >> $GITHUB_ENV
find . -maxdepth 1 -type f -name 'WSA.*' -exec bash -c 'mv "$1" "WSA_${{ env.WSA_VER }}_${{ inputs.arch }}${magiskVer}${gappsVar}${amazon}${1##*WSA}"' _ {} \;
- name: Upload Asset
uses: softprops/action-gh-release@v1
with:
files: ./output/${{ env.release_asset_name }}.*
name: WSA
tag_name: ${{ inputs.tag }}
prerelease: ${{ inputs.prerelease }}