-
-
Notifications
You must be signed in to change notification settings - Fork 176
143 lines (126 loc) · 5.5 KB
/
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
name: Auto Build function (Use for call only)
on:
workflow_call:
inputs:
arch:
type: string
gapps:
type: string
root:
type: string
release_type:
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.10'
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 ${{ inputs.arch }} with GApps ${{ inputs.root }} 🏗️
id: wsa
run: |
if [[ "${{ inputs.release_type }}" == "WIF" ]]; then
RLS_TYPE="latest"
else
RLS_TYPE="retail"
fi
if [[ "${{ inputs.gapps }}" == "MindTheGapps" ]]; then
WITH_GAPPS="--install-gapps"
else
WITH_GAPPS=""
fi
mkdir -p download
if [[ "${{ inputs.root }}" == *magisk* ]]; then
./scripts/build_with_lspinit.sh --arch ${{ inputs.arch }} --release-type $RLS_TYPE --magisk-branch topjohnwu --magisk-ver stable $WITH_GAPPS --root-sol ${{ inputs.root }} --remove-amazon --compress-format 7z
else
./scripts/build_with_mount.sh --arch ${{ inputs.arch }} --release-type $RLS_TYPE --magisk-branch topjohnwu --magisk-ver stable $WITH_GAPPS --root-sol ${{ inputs.root }} --remove-amazon --compress-format 7z
fi
- name: Pass to Windows 💸
uses: actions/upload-artifact@v4
with:
name: ${{ steps.wsa.outputs.artifact }}-${{ steps.wsa.outputs.built }}
path: output
- name: Prepare release tag 🏷️
id: date
run: |
if [[ "${{ inputs.release_type }}" == "WIF" ]]; then
echo "date=WSA-Insider-Version" >> $GITHUB_OUTPUT
else
echo "date=$(date +'v%Y-%m-%d')" >> $GITHUB_OUTPUT
fi
outputs:
zipname: ${{ steps.wsa.outputs.artifact }}
date: ${{ steps.date.outputs.date }}
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/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: 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.zipname }}").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.zipname }}"
}
- 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.zipname }}\$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 📦
run: 7z a -t7z -mx=6 -m0=LZMA2 -ms=on -mmt=8 -sdel -- "${{ needs.build.outputs.zipname }}.7z" ".\output\${{ needs.build.outputs.zipname }}\*"
- name: File Checksum ✔️
id: run
run: ("hash=" + $(Get-FileHash -Path "${{ needs.build.outputs.zipname }}.7z" -Algorithm SHA256).Hash.ToLower().ToString()) | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding UTF8 -Append
- name: Update build to release 🤌
uses: softprops/[email protected]
with:
files: ${{ needs.build.outputs.zipname }}.7z
fail_on_unmatched_files: true
append_body: true
tag_name: ${{ needs.build.outputs.date }}
body: ${{ steps.run.outputs.hash }} ${{ needs.build.outputs.zipname }}.7z