-
-
Notifications
You must be signed in to change notification settings - Fork 248
315 lines (268 loc) · 11 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
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
#
# Copyright (C) 2025 AuxXxilium <https://github.com/AuxXxilium>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
name: Build Arc Image
on:
workflow_dispatch:
inputs:
runs:
description: "runs-on"
type: choice
options:
- ubuntu-latest
- self-hosted
version:
description: "version (1.0.0)"
required: true
type: string
notice:
description: "Notice here"
required: false
type: string
latest:
description: "latest"
default: true
type: boolean
prerelease:
description: "pre release"
default: false
type: boolean
minimal:
description: "minimal"
default: true
type: boolean
extended:
description: "extended"
default: false
type: boolean
clean:
description: "clean"
default: false
type: boolean
jobs:
build:
runs-on: ${{ inputs.runs }}
steps:
- name: Checkout
uses: actions/checkout@main
- name: Delete releases and workflows runs
if: ${{ inputs.clean }}
uses: ophub/delete-releases-workflows@main
with:
delete_releases: true
releases_keep_latest: 1
delete_workflows: false
delete_tags: true
gh_token: ${{ secrets.GITHUB_TOKEN }}
# Install Dependencies
- name: Install Dependencies
if: ${{ inputs.runs == 'ubuntu-latest' }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "AuxXxilium"
sudo timedatectl set-timezone "Europe/Berlin"
sudo apt update
sudo apt install -y locales busybox dialog gettext sed gawk jq curl
sudo apt install -y python-is-python3 python3-pip libelf-dev qemu-utils cpio xz-utils lz4 lzma bzip2 gzip zstd
# sudo snap install yq
if ! command -v yq &>/dev/null || ! yq --version 2>/dev/null | grep -q "v4."; then
sudo curl -kL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/bin/yq && sudo chmod a+x /usr/bin/yq
fi
df -h
# Get extractor, LKM, Addons, Modules, Theme and Configs
- name: Get Dependencies for all Image
run: |
. scripts/func.sh "${{ secrets.BUILD_TOKEN }}"
echo "Get Dependencies"
getAddons "files/p3/addons"
getModules "files/p3/modules"
getConfigs "files/p3/configs"
getPatches "files/p3/patches"
getCustom "files/p3/custom"
getOffline "files/p3/configs"
getLKMs "files/p3/lkms"
getTheme "files/p1/boot/grub"
getBuildrootx "brx"
getBuildroots "brs"
# Export Dependencies Version to env
echo "ADDONTAG=${ADDONTAG}" >> $GITHUB_ENV
echo "MODULETAG=${MODULETAG}" >> $GITHUB_ENV
echo "CONFIGTAG=${CONFIGTAG}" >> $GITHUB_ENV
echo "PATCHTAG=${PATCHTAG}" >> $GITHUB_ENV
echo "CUSTOMTAG=${CUSTOMTAG}" >> $GITHUB_ENV
echo "LKMTAG=${LKMTAG}" >> $GITHUB_ENV
echo "THEMETAG=${THEMETAG}" >> $GITHUB_ENV
echo "BRXTAG=${BRXTAG}" >> $GITHUB_ENV
echo "BRSTAG=${BRSTAG}" >> $GITHUB_ENV
echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV
echo "OK"
# Build incremental
- name: Build extended Image
if: ${{ inputs.extended }}
run: |
. scripts/func.sh
# Modify Source File
ARC_BUILD="`date +'%y%m%d'`"
ARC_VERSION="${{ inputs.version }}"
ARC_BRANCH="extended"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
echo "Create Arc Image"
IMAGE_FILE="arc_create.img"
gzip -dc "grub.img.gz" >"${IMAGE_FILE}"
fdisk -l "${IMAGE_FILE}"
LOOPX=$(sudo losetup -f)
sudo losetup -P "${LOOPX}" "${IMAGE_FILE}"
echo "Mounting Image File"
mkdir -p "/tmp/p1"
mkdir -p "/tmp/p3"
sudo mount ${LOOPX}p1 "/tmp/p1"
sudo mount ${LOOPX}p3 "/tmp/p3"
[ ! -f "brx/bzImage-arc" ] || [ ! -f "brx/initrd-arc" ] && return 1
echo "Repack initrd"
cp -f "brx/bzImage-arc" "files/p3/bzImage-arc"
repackInitrd "brx/initrd-arc" "files/initrd" "files/p3/initrd-arc"
echo "Copying files"
sudo cp -rf "files/p1/"* "/tmp/p1"
sudo cp -rf "files/p3/"* "/tmp/p3"
sudo sync
echo "Unmount image file"
sudo umount "/tmp/p1"
sudo umount "/tmp/p3"
rmdir "/tmp/p1"
rmdir "/tmp/p3"
sudo losetup --detach ${LOOPX}
# Resize Image
resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" 2>/dev/null
rm -f "${IMAGE_FILE}"
echo "Image Converter"
IMAGE_FILE="arc.img"
qemu-img convert -p -f raw -O vmdk ${IMAGE_FILE} arc-dyn.vmdk
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk
echo "Create Arc vhd"
createvmc "arc.vmc"
qemu-img convert -p -f raw -O vpc ${IMAGE_FILE} arc.vhd
echo "Create Arc ova"
convertova "${IMAGE_FILE}" "arc.ova"
# Zip image and generate checksum
- name: Pack extended Image
if: ${{ inputs.extended }}
run: |
if [ -n "${{ env.ARC_VERSION }}" ]; then
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-dyn.zip" arc-dyn.vmdk
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vhd.zip" arc.vhd arc.vmc
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.ova.zip" arc.ova
(cd files && zip -r ../update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.zip ./p1 ./p3)
sha256sum update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.zip >"update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.hash"
fi
# Cleanup
- name: Cleanup
run: |
rm -rf "arc.img" "arc.vmdk" "arc-dyn.vmdk" "arc-flat.vmdk" "arc.vhd" "arc.ova" "arc.vmc" 2>/dev/null
# Build incremental
- name: Build minimal Image
if: ${{ inputs.minimal }}
run: |
. scripts/func.sh
# Modify Source File
ARC_BUILD="`date +'%y%m%d'`"
ARC_VERSION="${{ inputs.version }}"
ARC_BRANCH="minimal"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
echo "Create Arc Image"
IMAGE_FILE="arc_create.img"
gzip -dc "grub.img.gz" >"${IMAGE_FILE}"
fdisk -l "${IMAGE_FILE}"
LOOPX=$(sudo losetup -f)
sudo losetup -P "${LOOPX}" "${IMAGE_FILE}"
echo "Mounting Image File"
mkdir -p "/tmp/p1"
mkdir -p "/tmp/p3"
sudo mount ${LOOPX}p1 "/tmp/p1"
sudo mount ${LOOPX}p3 "/tmp/p3"
[ ! -f "brs/bzImage-arc" ] || [ ! -f "brs/initrd-arc" ] && return 1
echo "Repack initrd"
cp -f "brs/bzImage-arc" "files/p3/bzImage-arc"
repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc"
echo "Copying files"
sudo cp -rf "files/p1/"* "/tmp/p1"
sudo cp -rf "files/p3/"* "/tmp/p3"
sudo sync
echo "Unmount image file"
sudo umount "/tmp/p1"
sudo umount "/tmp/p3"
rmdir "/tmp/p1"
rmdir "/tmp/p3"
sudo losetup --detach ${LOOPX}
# Resize Image
resizeImg "${IMAGE_FILE}" "+1024M" "arc.img" 2>/dev/null
rm -f "${IMAGE_FILE}"
echo "Image Converter"
IMAGE_FILE="arc.img"
qemu-img convert -p -f raw -O vmdk ${IMAGE_FILE} arc-dyn.vmdk
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk
echo "Create Arc vhd"
createvmc "arc.vmc"
qemu-img convert -p -f raw -O vpc ${IMAGE_FILE} arc.vhd
echo "Create Arc ova"
convertova "${IMAGE_FILE}" "arc.ova"
# Zip image and generate checksum
- name: Pack minimal Image
if: ${{ inputs.minimal }}
run: |
if [ -n "${{ env.ARC_VERSION }}" ]; then
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.img.zip" arc.img
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-dyn.zip" arc-dyn.vmdk
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.vhd.zip" arc.vhd arc.vmc
zip -9 "arc-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.ova.zip" arc.ova
(cd files && zip -r ../update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.zip ./p1 ./p3)
sha256sum update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.zip >"update-${{ env.ARC_VERSION }}-${{ env.ARC_BRANCH }}.hash"
fi
# Publish a release if is a tag
- name: Release
if: success() && env.ARC_VERSION != ''
uses: ncipollo/release-action@v1
with:
tag: ${{ env.ARC_VERSION }}
prerelease: ${{ inputs.prerelease }}
makeLatest: ${{ inputs.latest }}
allowUpdates: true
body: |
### Note:
- ${{ inputs.notice }}
### Information:
- Changelog is available in my Discord
- Discord Account for Arc Patch needed
### Versions:
${{ inputs.minimal && '- minimal: Full Image, all dependencies are included (reduced size, faster boot)' || '' }}
${{ inputs.extended && '- extended: Full Image, all dependencies are included (new features to test)' || '' }}
### Dependencies:
- Addons: ${{ env.ADDONTAG }}
- Modules: ${{ env.MODULETAG }}
- Configs: ${{ env.CONFIGTAG }}
- Patches: ${{ env.PATCHTAG }}
- Custom: ${{ env.CUSTOMTAG }}
- LKMs: ${{ env.LKMTAG }}
${{ inputs.minimal && format('- Buildroot minimal: {0}', env.BRSTAG) || '' }}
${{ inputs.extended && format('- Buildroot extended: {0}', env.BRXTAG) || '' }}
### Release
- ${{ env.BUILD_TIME }}
artifacts: |
arc-*.zip
update-*.zip
update-*.hash