-
-
Notifications
You must be signed in to change notification settings - Fork 176
172 lines (157 loc) · 8.07 KB
/
custom_build.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
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:
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 Official","Magisk Alpha (vvb2060)","Magisk Delta (HuskyDG)"]
default: "Magisk Official"
magisk_channel:
type: choice
description: Magisk channel
required: true
options: ["Magisk Stable","Magisk Beta","Magisk Canary","Magisk Debug"]
default: "Magisk Stable"
gapps_brand:
type: choice
description: Google Apps brand
required: true
options: ["MindTheGapps v13.0","LiteGapps", "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
if: github.event.repository.fork == false
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: scripts/
- name: Setup Python3 Virtual Enviroment 🐍
working-directory: 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
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 Official"]="topjohnwu" ["ROOT_SOL,Magisk Delta (HuskyDG)"]="HuskyDG" ["ROOT_SOL,Magisk Alpha (vvb2060)"]="vvb2060" ["ROOT_SOL,KernelSU"]="kernelsu" ["ROOT_SOL,Non-root"]="none" ["MAGISK_TYPE,Magisk Stable"]="stable" ["MAGISK_TYPE,Magisk Beta"]="beta" ["MAGISK_TYPE,Magisk Canary"]="canary" ["MAGISK_TYPE,Magisk Debug"]="debug" ["GAPPS_BRAND,MindTheGapps v13.0"]="MindTheGapps" ["GAPPS_BRAND,LiteGapps"]="LiteGapps" ["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_BRANCH="${opts[ROOT_SOL,${{ inputs.root_sol }}]}"
ROOT_SOL="magisk"
else
MAGISK_BRANCH="topjohnwu"
ROOT_SOL="${opts[ROOT_SOL,${{ inputs.root_sol }}]}"
fi
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-branch "$MAGISK_BRANCH" --magisk-ver "${opts[MAGISK_TYPE,${{ inputs.magisk_channel }}]}" --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
env:
API_KEY: ${{ secrets.API_KEY }}
- name: Pass to Windows 💸
uses: actions/cache/save@v4
with:
path: output
key: ${{ steps.wsa.outputs.artifact }}-${{ steps.wsa.outputs.built }}
enableCrossOsArchive: true
outputs:
artifact: ${{ steps.wsa.outputs.artifact }}
built: ${{ steps.wsa.outputs.built }}
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/cache/restore@v4
with:
path: output
key: ${{ needs.build.outputs.artifact }}-${{ needs.build.outputs.built }}
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: Compress 7-Zip and Add checksum ✔️
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 Artifact 📦
uses: actions/upload-artifact@v4
with:
name: ${{ needs.build.outputs.artifact }}-compressed
path: output