-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
239 lines (212 loc) · 10.2 KB
/
build_old.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
name: Auto Build function (Use for call only)
on:
workflow_call:
inputs:
arch:
type: string
gapps:
type: string
root:
type: string
insider:
type: string
magiskver:
type: string
devicemodel:
type: string
amazonflag:
type: string
compressformat:
type: string
wsa_ver:
type: string
jobs:
build:
name: Build WSA
runs-on: ubuntu-latest
steps:
- name: Checkout ♻️
uses: actions/checkout@v4
- name: Setup Python 🏭
uses: actions/setup-python@v5
with:
check-latest: true
python-version: '3.x'
cache: 'pip'
cache-dependency-path: MagiskOnWSAOld/scripts/
- name: Setup Python3 Virtual Enviroment 🐍
working-directory: MagiskOnWSAOld/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: Check workflow inputs
run: |
echo ${{ inputs.arch }}
echo ${{ inputs.gapps }}
echo ${{ inputs.root }}
echo ${{ inputs.insider }}
echo ${{ inputs.magiskver }}
echo ${{ inputs.devicemodel }}
echo ${{ inputs.amazonflag }}
echo ${{ inputs.compressformat }}
echo ${{ inputs.release_type }}
- name: Build WSA ${{ inputs.arch }} with GApps ${{ inputs.root }} 🏗️
id: wsa
working-directory: MagiskOnWSAOld
run: |
if [[ "${{ inputs.release_type }}" == "WIF" ]]; then
RLS_TYPE="latest"
else
RLS_TYPE="retail"
fi
chmod -R 777 ./
mkdir -p download
./scripts/build.sh --arch ${{ inputs.arch }} --release-type latest --magisk-ver ${{ inputs.magiskver }} --gapps-brand ${{ inputs.gapps }} --root-sol ${{ inputs.root }} --custom-model ${{ inputs.devicemodel }} ${{ inputs.amazonflag }} --compress-format ${{ inputs.compressformat }}
- name: Prepare release tag 🏷️
id: releasetag
run: |
currentver=${{ inputs.wsa_ver }}
folderpath="/WSABuilds/Builds/Windows Subsystem For Android™ v$currentver/Windows 11/Windows 11 x86_64"
folderpathwin10="/WSABuilds/Builds/Windows Subsystem For Android™ v$currentver/Windows 10/"
echo "DRIVE_FOLDER_PATH=$folderpath" >> $GITHUB_ENV
echo "DRIVE_FOLDER_PATH_WIN10=$folderpathwin10" >> $GITHUB_ENV
echo "WSA_TAG=Windows_11_$currentver" >> $GITHUB_ENV
echo "WSA_TAG_WIN10=Windows_10_$currentver" >> $GITHUB_ENV
echo "WSA_VER=$currentver" >> $GITHUB_ENV
- name: Check GitHub ENV variables
run: |
echo ${{ steps.wsa.outputs.artifact }}
echo ${{ steps.wsa.outputs.artifact_folder }}
echo ${{ steps.date.outputs.date }}
echo ${{ steps.wsa.outputs.built }}
echo ${{ env.WSA_TAG }}
echo ${{ env.WSA_TAG_WIN10 }}
echo ${{ env.WSA_VER }}
echo ${{ env.DRIVE_FOLDER_PATH }}
echo ${{ env.DRIVE_FOLDER_PATH_WIN10 }}
- name: Pass to Windows 💸
uses: actions/upload-artifact@v4
with:
name: ${{ steps.wsa.outputs.artifact }}-${{ steps.wsa.outputs.built }}
path: MagiskOnWSAOld/output
outputs:
zipname: ${{ steps.wsa.outputs.artifact }}
artifact_folder: ${{ steps.wsa.outputs.artifact_folder }}
date: ${{ steps.date.outputs.date }}
built: ${{ steps.wsa.outputs.built }}
tag: ${{ env.WSA_TAG }}
tagwin10: ${{ env.WSA_TAG_WIN10 }}
wsaver: ${{ env.WSA_VER }}
onedrivepath: ${{ env.DRIVE_FOLDER_PATH }}
onedrivepathwin10: ${{ env.DRIVE_FOLDER_PATH_WIN10 }}
make-pri:
name: Merge PRI resources
runs-on: windows-latest
needs: build
steps:
- name: Checkout ♻️
uses: actions/checkout@v4
- name: Download built artifact ⌛
uses: actions/download-artifact@v4
with:
path: output
name: ${{ needs.build.outputs.zipname }}-${{ needs.build.outputs.built }}
- name: Remove unused artifact ❌
uses: geekyeggo/delete-artifact@v5
with:
name: ${{ needs.build.outputs.zipname }}-${{ needs.build.outputs.built }}
- name: Check Subdirectories and Directories 1
run: tree /F ${{ github.workspace }}
- name: Check Subdirectories and Directories 2
run: tree /F "${{ github.workspace }}\output\${{ needs.build.outputs.artifact_folder }}"
- 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_folder }}").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_folder }}"
}
- 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_folder }}\$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: Compress artifact for Windows 11 x64 Build📦
run: 7z a -t7z -mx=6 -m0=LZMA2 -ms=on -mmt=8 -- "${{ needs.build.outputs.zipname }}.7z" .\output\*
# - name: Setup rclone 🎚️
# uses: AnimMouse/setup-rclone@v1.9.0
# with:
# rclone_config: ${{ secrets.RCLONE_CONFIG }}
#
# - name: Upload build to OneDrive for Windows 11 x64 Build⏫
# run: |
# echo ${{ needs.build.outputs.onedrivepath }}
# rclone copy ${{ needs.build.outputs.zipname }}.7z OneDrive:"${{ needs.build.outputs.onedrivepath }}" --create-empty-src-dirs
# env:
# RCLONE_CONFIG_PASS: ${{ secrets.RCLONE_CONFIG_PASS }}
- name: Upload Windows 11 x64 build to release 🤌
uses: softprops/action-gh-release@v2
with:
files: ${{ needs.build.outputs.zipname }}.7z
fail_on_unmatched_files: true
append_body: false
tag_name: ${{ needs.build.outputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check Subdirectories and Directories 3
run: tree /F ${{ github.workspace }}
- name: Check Subdirectories and Directories 4
run: tree /F "${{ github.workspace }}\output\${{ needs.build.outputs.artifact_folder }}"
- name: Run WSA Windows 10 PowerShell Patch Script
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 artifact for Windows 10 x64 Build📦
run: 7z a -t7z -mx=6 -m0=LZMA2 -ms=on -mmt=8 -sdel -- "${{ needs.build.outputs.zipname }}_Windows_10.7z" .\output\*
# - name: Upload build to OneDrive for Windows 10 x64 Build⏫
# run: |
# echo ${{ needs.build.outputs.onedrivepathwin10 }}
# rclone copy ${{ needs.build.outputs.zipname }}_Windows_10.7z OneDrive:"${{ needs.build.outputs.onedrivepathwin10 }}" --create-empty-src-dirs
# env:
# RCLONE_CONFIG_PASS: ${{ secrets.RCLONE_CONFIG_PASS }}
- name: Upload Windows 10 x64 build to release 🤌
uses: softprops/action-gh-release@v2
with:
files: ${{ needs.build.outputs.zipname }}_Windows_10.7z
fail_on_unmatched_files: true
append_body: false
tag_name: ${{ needs.build.outputs.tagwin10 }}
token: ${{ secrets.GITHUB_TOKEN }}