-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
224 lines (203 loc) · 11.1 KB
/
Copy pathbuildtester.yml
File metadata and controls
224 lines (203 loc) · 11.1 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
name: Custom Build (for testing purpose)
run-name: WSA ${{ inputs.release_type }} ${{ inputs.arch }} with ${{ inputs.root_sol }} and ${{ inputs.gapps_brand }} as ${{ inputs.custom_model }}
on:
workflow_dispatch:
inputs:
wintype:
type: choice
description: Target Windows version.
required: true
options: ["Windows 10","Windows 11"]
default: "Windows 11"
arch:
type: choice
description: Target CPU architecture of WSA.
required: true
options: [x64, arm64]
default: x64
release_type:
type: choice
description: WSA Release Channel
required: true
options: ["Retail","Release Preview","Insider Slow","Insider Fast","Insider Private"]
default: "Retail"
user_code:
type: string
description: User code for WSA Insider User (Optional)
required: false
default: ""
root_sol:
type: choice
description: Root solution
required: true
options: ["Non-root","KernelSU","Magisk Stable","Magisk Beta","Magisk Canary","Magisk Debug","Magisk Alpha (vvb2060)","Magisk Delta (HuskyDG)"]
default: "Magisk Stable"
gapps_brand:
type: choice
description: Google Apps brand
required: true
options: ["MindTheGapps v13.0","No GApps"]
default: "MindTheGapps v13.0"
custom_model:
type: choice
description: Custom model
required: true
options: ["WSA Default", "Pixel 4a", "Pixel 4a (5G)", "Pixel 5", "Pixel 5a", "Pixel 6", "Pixel 6 Pro", "Pixel 6a", "Pixel 7", "Pixel 7 Pro", "Pixel 7a", "Pixel Tablet", "Pixel Fold"]
default: "Pixel 5"
compression:
type: choice
description: Compression format.
required: true
options: [".zip",".7z"]
default: ".7z"
remove_amazon:
description: "Remove Amazon Appstore from the system"
required: true
default: true
type: boolean
jobs:
build:
name: Build WSA
runs-on: ubuntu-latest
steps:
- name: Check inputs
run: |
if [[ "${{ github.event.inputs.wintype }}" == "Windows 10" && "${{ github.event.inputs.arch }}" == "arm64" ]]; then
echo "Windows 10 patch does not support arm64 architecture"
exit 1
else
echo "Inputs are valid"
fi
- name: Checkout ♻️
uses: actions/checkout@v7
- name: Setup Python 👷
uses: actions/setup-python@v6
with:
check-latest: true
python-version: '3.x'
cache: 'pip'
cache-dependency-path: MagiskOnWSA/scripts/
- name: Setup Python3 Virtual Enviroment 🐍
working-directory: MagiskOnWSA/scripts
run: |
sudo apt-get update
PYTHON_VENV_DIR="$(dirname "$PWD")/python3-env"
python3 -m venv "$PYTHON_VENV_DIR" || abort "Failed to create python3 virtual env"
# shellcheck disable=SC1091
source "$PYTHON_VENV_DIR/bin/activate" || abort "Failed to activate python3 virtual env"
python3 -c "import pkg_resources; pkg_resources.require(open('requirements.txt',mode='r'))" &>/dev/null || {
echo "Installing Python3 dependencies"
python3 -m pip install --upgrade -r requirements.txt || abort "Failed to install python3 dependencies"
}
deactivate
- name: Install Ubuntu Dependencies 🧑🏭
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: e2fsprogs attr unzip qemu-utils python3-venv
version: 1.0
- name: Build WSA 🏗️
id: wsa
working-directory: MagiskOnWSA
run: |
declare -A opts=( ["RELEASE_TYPE,Retail"]="retail" ["RELEASE_TYPE,Release Preview"]="RP" ["RELEASE_TYPE,Insider Slow"]="WIS" ["RELEASE_TYPE,Insider Fast"]="WIF" ["RELEASE_TYPE,Insider Private"]="latest" ["ROOT_SOL,Magisk Stable"]="stable" ["ROOT_SOL,Magisk Beta"]="beta" ["ROOT_SOL,Magisk Canary"]="canary" ["ROOT_SOL,Magisk Debug"]="debug" ["ROOT_SOL,Magisk Delta (HuskyDG)"]="delta" ["ROOT_SOL,Magisk Alpha (vvb2060)"]="alpha" ["ROOT_SOL,KernelSU"]="kernelsu" ["ROOT_SOL,Non-root"]="none" ["GAPPS_BRAND,MindTheGapps v13.0"]="MindTheGapps" ["GAPPS_BRAND,No GApps"]="none" ["CUSTOM_MODEL,WSA Default"]="none" ["CUSTOM_MODEL,Pixel 4a"]="sunfish" ["CUSTOM_MODEL,Pixel 4a (5G)"]="bramble" ["CUSTOM_MODEL,Pixel 5"]="redfin" ["CUSTOM_MODEL,Pixel 5a"]="barbet" ["CUSTOM_MODEL,Pixel 6 Pro"]="raven" ["CUSTOM_MODEL,Pixel 6"]="oriole" ["CUSTOM_MODEL,Pixel 6a"]="bluejay" ["CUSTOM_MODEL,Pixel 7"]="panther" ["CUSTOM_MODEL,Pixel 7 Pro"]="cheetah" ["CUSTOM_MODEL,Pixel 7a"]="lynx" ["CUSTOM_MODEL,Pixel Tablet"]="tangorpro" ["CUSTOM_MODEL,Pixel Fold"]="felix" ["REMOVE_AMAZON,true"]="--remove-amazon" ["COMPRESSION,.zip"]="zip" ["COMPRESSION,.7z"]="7z" )
if [[ "${{ inputs.root_sol }}" == *Magisk* ]]; then
MAGISK_VER="${opts[ROOT_SOL,${{ inputs.root_sol }}]}"
ROOT_SOL="magisk"
else
MAGISK_VER="${opts[ROOT_SOL,Magisk Stable]}"
ROOT_SOL="${opts[ROOT_SOL,${{ inputs.root_sol }}]}"
fi
chmod -R 777 ./
mkdir -p download
echo -e "user_code=$(cat $GITHUB_EVENT_PATH | jq -r '.inputs.user_code')" > download/.ms_account
./scripts/build.sh --arch ${{ inputs.arch }} --release-type ${opts[RELEASE_TYPE,${{ inputs.release_type }}]} --magisk-ver $MAGISK_VER --gapps-brand ${opts[GAPPS_BRAND,${{ inputs.gapps_brand }}]} --custom-model ${opts[CUSTOM_MODEL,${{ inputs.custom_model }}]} --root-sol $ROOT_SOL --compress-format ${opts[COMPRESSION,${{ inputs.compression }}]} ${opts[REMOVE_AMAZON,${{ inputs.remove_amazon }}]} --after-compress
shell: bash
- name: Set date
id: date
run: echo "DATE=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
shell: bash
- name: Pass to Windows 💸
uses: actions/cache/save@v6
with:
path: MagiskOnWSA/output
key: ${{ steps.wsa.outputs.artifact }}-${{ steps.date.outputs.date }}
enableCrossOsArchive: true
outputs:
artifact: ${{ steps.wsa.outputs.artifact }}
built: ${{ steps.wsa.outputs.built }}
date: ${{ steps.date.outputs.date }}
make-pri:
name: Merge PRI resources
runs-on: windows-latest
needs: build
steps:
- name: Checkout ♻️
uses: actions/checkout@v7
- name: Download built artifact ⌛
uses: actions/cache/restore@v6
with:
path: output
key: ${{ needs.build.outputs.artifact }}-${{ needs.build.outputs.date }}
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Merge language and density resources 🧙🏻♂️
run: |
if ("${{ inputs.arch }}" -eq "x64") {
(Start-Process pwsh.exe -NoNewWindow -PassThru -Args "-ExecutionPolicy Bypass -File MakePri.ps1" -WorkingDirectory "${{ github.workspace }}\output\${{ needs.build.outputs.artifact }}").WaitForExit()
} else {
Copy-Item -Force "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\arm64\makepri.exe" "${{ github.workspace }}\output\${{ needs.build.outputs.artifact }}"
}
- name: Compact Images 💿
run: |
foreach ($Partition in 'system','product','system_ext','vendor') {
Write-Output "Optimizing of $Partition..."
Write-Output "SELECT VDISK FILE=`"${{ github.workspace }}\output\${{ needs.build.outputs.artifact }}\$Partition.vhdx`"`
ATTACH VDISK READONLY`
COMPACT VDISK`
DETACH VDISK" | Set-Content -Path "$Partition.txt" -Encoding Ascii
Start-Process -NoNewWindow -Wait "diskpart.exe" -Args "/s $Partition.txt" -RedirectStandardOutput NUL
}
- name: Run WSA Windows 10 PowerShell Patch Script
if: inputs.wintype == 'Windows 10'
run: |
Write-Output "`r`nPatching Windows 10 AppxManifest file..."
$outputDir = "${{ github.workspace }}\output\${{ needs.build.outputs.artifact_folder }}"
$xml = [xml](Get-Content "$outputDir\AppxManifest.xml")
$nsm = New-Object Xml.XmlNamespaceManager($xml.NameTable)
$nsm.AddNamespace('rescap', "http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities")
$nsm.AddNamespace('desktop6', "http://schemas.microsoft.com/appx/manifest/desktop/windows10/6")
$node = $xml.Package.Capabilities.SelectSingleNode("rescap:Capability[@Name='customInstallActions']", $nsm)
$xml.Package.Capabilities.RemoveChild($node) | Out-Null
$node = $xml.Package.Extensions.SelectSingleNode("desktop6:Extension[@Category='windows.customInstall']", $nsm)
$xml.Package.Extensions.RemoveChild($node) | Out-Null
$xml.Package.Dependencies.TargetDeviceFamily.MinVersion = "10.0.19041.264"
$xml.Save("$outputDir\AppxManifest.xml")
Write-Output "`r`nDownloading modifided DLL file..."
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://github.com/MustardChef/WSAPatch/raw/main/DLLs%20for%20WSABuilds/winhttp.dll" -OutFile "$outputDir\WSAClient\winhttp.dll"
Invoke-WebRequest -Uri "https://github.com/MustardChef/WSAPatch/raw/main/DLLs%20for%20WSABuilds/WsaPatch.dll" -OutFile "$outputDir\WSAClient\WsaPatch.dll"
Invoke-WebRequest -Uri "https://github.com/MustardChef/WSAPatch/raw/main/DLLs%20for%20WSABuilds/icu.dll" -OutFile "$outputDir\WSAClient\icu.dll"
shell: pwsh
- name: Compress 7-Zip and Add checksum (Windows 10) ✔️
if: inputs.compression == '.7z' && inputs.wintype == 'Windows 10'
working-directory: output
run: |
7z a -t7z -mx=6 -m0=LZMA2 -ms=on -mmt=8 -sdel -- ${{ needs.build.outputs.artifact }}_Windows_10.7z ${{ needs.build.outputs.artifact }}\*
($(Get-FileHash -Path ${{ needs.build.outputs.artifact }}_Windows_10.7z -Algorithm SHA256).Hash.ToLower().ToString() + " " + "${{ needs.build.outputs.artifact }}_Windows_10.7z") | Out-File -FilePath sha256-checksum.txt -Encoding UTF8
- name: Compress 7-Zip and Add checksum (Windows 11) ✔️
if: inputs.compression == '.7z'
working-directory: output
run: |
7z a -t7z -mx=6 -m0=LZMA2 -ms=on -mmt=8 -sdel -- ${{ needs.build.outputs.artifact }}.7z ${{ needs.build.outputs.artifact }}\*
($(Get-FileHash -Path ${{ needs.build.outputs.artifact }}.7z -Algorithm SHA256).Hash.ToLower().ToString() + " " + "${{ needs.build.outputs.artifact }}.7z") | Out-File -FilePath sha256-checksum.txt -Encoding UTF8
- name: Upload Windows 11 Artifact 📦
uses: actions/upload-artifact@v7
with:
name: ${{ needs.build.outputs.artifact }}-compressed
path: output
- name: Upload Windows 10 Artifact 📦
if: inputs.wintype == 'Windows 10'
uses: actions/upload-artifact@v7
with:
name: ${{ needs.build.outputs.artifact }}_Windows_10-compressed
path: output