forked from pkgforge/soar
-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·505 lines (475 loc) · 25.4 KB
/
static_release.yaml
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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
name: 🛍️ soar 📦 (aarch64 || x86_64) Linux Build 📦🗄️
on:
workflow_dispatch:
schedule:
- cron: "0 */1 * * *" #@every 1hrs
#env:
#SKIP_X86_64: "NO" #YES--> SKip x86_64-Linux Build
#SKIP_AARCH64: "NO" #YES--> SKip aarch64-Linux Build
#------------------------------------------------------------------------------------#
jobs:
sync-upstream:
name: Sync Upstream
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
SKIP_X86_64: ${{ steps.set-outputs.outputs.SKIP_X86_64 }}
SKIP_AARCH64: ${{ steps.set-outputs.outputs.SKIP_AARCH64 }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
filter: "blob:none"
- name: Setup Env
run: |
#Presets
set +x ; set +e
#--------------#
##Install coreutils
sudo apt-get update -y -qq && sudo apt-get install curl coreutils dos2unix file findutils gawk git jq moreutils rsync tar xz-utils util-linux wget zip -y -qq
##Install Addons
#https://github.com/Azathothas/Arsenal/blob/main/misc/Linux/install_dev_tools.sh
bash <(curl -qfsSL "https://pub.ajam.dev/repos/Azathothas/Arsenal/misc/Linux/install_dev_tools.sh")
##Create Output Dir
mkdir -p "${GITHUB_WORKSPACE}/main"
continue-on-error: true
- name: Sync "${GITHUB_WORKSPACE}/main" <-- "(https://github.com/pkgforge/soar)"
id: set-outputs
run: |
#Presets
set +x ; set +e
#--------------#
##Main
pushd "$(mktemp -d)" >/dev/null 2>&1 && git clone --filter="blob:none" --quiet "https://github.com/pkgforge/soar" && cd "./soar"
LATEST_COMMIT="$(git rev-parse HEAD | tr -d "[:space:]")" && export LATEST_COMMIT="${LATEST_COMMIT}"
LATEST_COMMI_M="$(git log -1 --pretty="%B" | head -n 1)" && export LATEST_COMMIT="${LATEST_COMMIT}"
echo "LATEST_COMMI_M=${LATEST_COMMI_M}" >> "${GITHUB_ENV}"
PREV_COMMIT="$(cat "${GITHUB_WORKSPACE}/main/.github/LATEST.txt" 2>/dev/null)" && export PREV_COMMIT="${PREV_COMMIT}"
if [ "${LATEST_COMMIT}" == "${PREV_COMMIT}" ]; then
#Skip Build
export SKIP_X86_64="YES"
echo "SKIP_X86_64=${SKIP_X86_64}" >> "${GITHUB_ENV}"
echo "SKIP_X86_64=${SKIP_X86_64}" >> "${GITHUB_OUTPUT}"
export SKIP_AARCH64="YES"
echo "SKIP_AARCH64=${SKIP_AARCH64}" >> "${GITHUB_ENV}"
echo "SKIP_AARCH64=${SKIP_AARCH64}" >> "${GITHUB_OUTPUT}"
else
#Sync Repo
echo "${LATEST_COMMIT}" > "${GITHUB_WORKSPACE}/main/.github/LATEST.txt"
sed '/^$/d' -i "${GITHUB_WORKSPACE}/main/.github/LATEST.txt"
rm -rfv "./.git/" "./.githooks/" "./.github/" 2>/dev/null
rsync -achLv --remove-source-files --exclude="./.git/**" --exclude="./.github/**" "./" "${GITHUB_WORKSPACE}/main/"
#Trigger Build
export SKIP_X86_64="NO"
echo "SKIP_X86_64=${SKIP_X86_64}" >> "${GITHUB_ENV}"
echo "SKIP_X86_64=${SKIP_X86_64}" >> "${GITHUB_OUTPUT}"
export SKIP_AARCH64="NO"
echo "SKIP_AARCH64=${SKIP_AARCH64}" >> "${GITHUB_ENV}"
echo "SKIP_AARCH64=${SKIP_AARCH64}" >> "${GITHUB_OUTPUT}"
fi
popd >/dev/null 2>&1
continue-on-error: true
- name: Get DateTime
run: |
#Presets
set +x ; set +e
#--------------#
NEPALI_TIME="$(TZ='Asia/Kathmandu' date +'%Y-%m-%d (%I:%M:%S %p)')"
echo "NEPALI_TIME=${NEPALI_TIME}" >> "${GITHUB_ENV}"
continue-on-error: true
- uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: ./main
commit_user_name: Azathothas
commit_user_email: [email protected]
commit_message: "♻️ Synced Soar 📦 <-- ${{ env.LATEST_COMMI_M }} ⌚"
#------------------------------------------------------------------------------------#
build-x86_64-Linux:
if: needs.sync-upstream.outputs.SKIP_X86_64 == 'NO'
name: Build On (x86_64-Linux)
runs-on: ubuntu-latest
needs: [sync-upstream]
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
filter: "blob:none"
- name: Install CoreUtils & Deps
run: |
#presets
set -x ; set +e
#-------------#
export DEBIAN_FRONTEND="noninteractive"
sudo apt update -y -qq
sudo apt install 7zip b3sum bc binutils binutils-aarch64-linux-gnu coreutils curl dos2unix fdupes jq moreutils wget -y -qq
sudo apt-get install apt-transport-https apt-utils ca-certificates binutils binutils-aarch64-linux-gnu coreutils dos2unix fdupes gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux upx util-linux wget -y -qq 2>/dev/null ; sudo apt-get update -y 2>/dev/null
#Do again, sometimes fails
sudo apt install 7zip b3sum bc binutils binutils-aarch64-linux-gnu coreutils curl dos2unix fdupes jq moreutils wget -y -qq
sudo apt-get install apt-transport-https apt-utils ca-certificates binutils binutils-aarch64-linux-gnu coreutils dos2unix fdupes gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux upx util-linux wget -y -qq2>/dev/null ; sudo apt-get update -y 2>/dev/null
continue-on-error: true
- name: Setup Env
run: |
#presets
set -x ; set +e
#-------------#
##tmp
SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}"
echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}"
##Artifacts
ARTIFACTS="${SYSTMP}/ARTIFACTS-$(uname -m)-$(uname -s)" && export "ARTIFACTS=${ARTIFACTS}"
echo "ARTIFACTS=${ARTIFACTS}" >> "${GITHUB_ENV}"
##Rclone
mkdir -p "${HOME}/.config/rclone"
echo "NOPE" > "${HOME}/.config/rclone/rclone.conf"
##User-Agent
USER_AGENT="$(curl -qfsSL 'https://pub.ajam.dev/repos/Azathothas/Wordlists/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}"
echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}"
##Prep
cd "$GITHUB_WORKSPACE/main"
find "$GITHUB_WORKSPACE/main" -type f ! -path "./.git/*" -exec dos2unix {} \; 2>/dev/null
find "$GITHUB_WORKSPACE/main" -type f ! -path "./.git/*" -name '*.sh' -exec shellcheck --severity=error {} \; 2>/dev/null | tee "$GITHUB_WORKSPACE/main/.github/shellcheck.txt"
continue-on-error: true
- name: Install Addons
run: |
# Presets
set +x ; set +e
#--------------#
#https://github.com/Azathothas/Arsenal/blob/main/misc/Linux/install_dev_tools.sh
bash <(curl -qfsSL "https://pub.ajam.dev/repos/Azathothas/Arsenal/misc/Linux/install_dev_tools.sh")
continue-on-error: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
continue-on-error: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
continue-on-error: true
- name: Build Binaries (x86_64-Linux)
env:
GITHUB_TOKEN: "${{ github.token }}"
run: |
#presets
set -x ; set +e
#-------------#
#Build
pushd "$(mktemp -d)" >/dev/null 2>&1
docker stop "alpine-builder" 2>/dev/null ; docker rm "alpine-builder" 2>/dev/null
docker run --platform="linux/amd64" --privileged --net="host" --name "alpine-builder" -e GITHUB_TOKEN="${GITHUB_TOKEN}" --pull="always" "azathothas/alpine-builder:latest" \
bash -l -c '
#Setup ENV
mkdir -p "/build-bins" && pushd "$(mktemp -d)" >/dev/null 2>&1
source "${HOME}/.cargo/env"
export RUST_TARGET="x86_64-unknown-linux-musl"
rustup target add "${RUST_TARGET}"
export RUSTFLAGS="-C target-feature=+crt-static -C default-linker-libraries=yes -C link-self-contained=yes -C prefer-dynamic=no -C embed-bitcode=yes -C lto=yes -C opt-level=z -C debuginfo=none -C strip=symbols -C linker=clang -C link-arg=-fuse-ld=$(which mold) -C link-arg=-Wl,--Bstatic -C link-arg=-Wl,--static -C link-arg=-Wl,-S -C link-arg=-Wl,--build-id=none"
#Build
git clone --filter "blob:none" --quiet "https://github.com/pkgforge/soar" && cd "./soar"
echo -e "\n[+] Target: ${RUST_TARGET}\n"
echo -e "\n[+] Flags: ${RUSTFLAGS}\n"
sed "/^\[profile\.release\]/,/^$/d" -i "./Cargo.toml" ; echo -e "\n[profile.release]\nstrip = true\nopt-level = 3\nlto = true" >> "./Cargo.toml"
rm rust-toolchain* 2>/dev/null
cargo build --target "${RUST_TARGET}" --release --jobs="$(($(nproc)+1))" --keep-going
#Copy
find "./target/${RUST_TARGET}/release" -maxdepth 1 -type f -exec file -i "{}" \; | grep "application/.*executable" | cut -d":" -f1 | xargs realpath | xargs -I {} rsync -achvL "{}" "/build-bins/"
#Strip
find "/build-bins/" -type f -exec objcopy --remove-section=".comment" --remove-section=".note.*" "{}" \;
find "/build-bins/" -type f ! -name "*.no_strip" -exec strip --strip-debug --strip-dwo --strip-unneeded --preserve-dates "{}" \; 2>/dev/null
#Rename
find "/build-bins/" -type f ! -name "*.txt" -exec bash -c '\''mv "$0" "${0}-x86_64-Linux"'\'' {} \; 2>/dev/null
#UPX
find "/build-bins/" -type f | xargs realpath | xargs -I {} upx --best "{}" -f --force-overwrite -o"{}.upx" -qq 2>/dev/null
popd >/dev/null 2>&1
'
#Copy
sudo docker cp "alpine-builder:/build-bins/." "$(pwd)/"
find "." -maxdepth 1 -type f -exec sh -c 'file "{}"; du -sh "{}"' \;
sudo rsync -av --copy-links --exclude="*/" "./." "${ARTIFACTS}/"
sudo chown -R "$(whoami):$(whoami)" "${ARTIFACTS}" && chmod -R 755 "${ARTIFACTS}"
#End
sudo docker stop "alpine-builder" 2>/dev/null ; sudo docker rm "alpine-builder" 2>/dev/null
popd >/dev/null 2>&1
continue-on-error: true
- name: Archive Binaries (.tar)
run: |
#presets
set -x ; set +e
#-------------#
if [ -d "${ARTIFACTS}" ] && [ "$(find "${ARTIFACTS}" -mindepth 1 -print -quit 2>/dev/null)" ]; then
7z a -ttar -mx="9" -mmt="$(($(nproc)+1))" -bt "${ARTIFACTS}.tar" "${ARTIFACTS}" 2>/dev/null
sha256sum "${ARTIFACTS}.tar" && du -sh "${ARTIFACTS}.tar"
export HAS_RELEASE="TRUE"
echo "HAS_RELEASE=${HAS_RELEASE}" >> "${GITHUB_ENV}"
else
export HAS_RELEASE="FALSE"
echo "HAS_RELEASE=${HAS_RELEASE}" >> "${GITHUB_ENV}"
exit 1
fi
continue-on-error: false
- name: Upload_ARTIFACTS-x86_64-Linux
uses: actions/upload-artifact@v4
with:
name: ARTIFACTS-x86_64-Linux.tar
path: |
/tmp/ARTIFACTS-x86_64-Linux.tar
#------------------------------------------------------------------------------------#
build-aarch64-Linux:
if: needs.sync-upstream.outputs.SKIP_AARCH64 == 'NO'
name: Build On (aarch64-Linux)
runs-on: ubuntu-latest
needs: [sync-upstream]
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
filter: "blob:none"
- name: Install CoreUtils & Deps
run: |
#presets
set -x ; set +e
#-------------#
export DEBIAN_FRONTEND="noninteractive"
sudo apt update -y -qq
sudo apt install 7zip b3sum bc binutils binutils-aarch64-linux-gnu coreutils curl dos2unix fdupes jq moreutils wget -y -qq
sudo apt-get install apt-transport-https apt-utils ca-certificates binutils binutils-aarch64-linux-gnu coreutils dos2unix fdupes gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux upx util-linux wget -y -qq 2>/dev/null ; sudo apt-get update -y 2>/dev/null
#Do again, sometimes fails
sudo apt install 7zip b3sum bc binutils binutils-aarch64-linux-gnu coreutils curl dos2unix fdupes jq moreutils wget -y -qq
sudo apt-get install apt-transport-https apt-utils ca-certificates binutils binutils-aarch64-linux-gnu coreutils dos2unix fdupes gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux upx util-linux wget -y -qq 2>/dev/null ; sudo apt-get update -y 2>/dev/null
continue-on-error: true
- name: Setup Env
run: |
#presets
set -x ; set +e
#-------------#
##tmp
SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}"
echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}"
##Artifacts
#ARTIFACTS="${SYSTMP}/ARTIFACTS-$(uname -m)-$(uname -s)" && export "ARTIFACTS=${ARTIFACTS}"
ARTIFACTS="${SYSTMP}/ARTIFACTS-aarch64-Linux" && export "ARTIFACTS=${ARTIFACTS}"
echo "ARTIFACTS=${ARTIFACTS}" >> "${GITHUB_ENV}"
##Rclone
mkdir -p "${HOME}/.config/rclone"
echo "NOPE" > "${HOME}/.config/rclone/rclone.conf"
##User-Agent
USER_AGENT="$(curl -qfsSL 'https://pub.ajam.dev/repos/Azathothas/Wordlists/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}"
echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}"
continue-on-error: true
- name: Install Addons
run: |
# Presets
set +x ; set +e
#--------------#
#https://github.com/Azathothas/Arsenal/blob/main/misc/Linux/install_dev_tools.sh
bash <(curl -qfsSL "https://pub.ajam.dev/repos/Azathothas/Arsenal/misc/Linux/install_dev_tools.sh")
continue-on-error: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
continue-on-error: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
continue-on-error: true
- name: Build Binaries (aarch64-Linux)
env:
GITHUB_TOKEN: "${{ github.token }}"
run: |
#presets
set -x ; set +e
#-------------#
#Build
pushd "$(mktemp -d)" >/dev/null 2>&1
docker stop "alpine-builder" 2>/dev/null ; docker rm "alpine-builder" 2>/dev/null
docker run --platform="linux/arm64" --privileged --net="host" --name "alpine-builder" -e GITHUB_TOKEN="${GITHUB_TOKEN}" --pull="always" "azathothas/alpine-builder:latest" \
bash -l -c '
#Setup ENV
mkdir -p "/build-bins" && pushd "$(mktemp -d)" >/dev/null 2>&1
source "${HOME}/.cargo/env"
export RUST_TARGET="aarch64-unknown-linux-musl"
rustup target add "${RUST_TARGET}"
export RUSTFLAGS="-C target-feature=+crt-static -C default-linker-libraries=yes -C link-self-contained=yes -C prefer-dynamic=no -C embed-bitcode=yes -C lto=yes -C opt-level=z -C debuginfo=none -C strip=symbols -C linker=clang -C link-arg=-fuse-ld=$(which mold) -C link-arg=-Wl,--Bstatic -C link-arg=-Wl,--static -C link-arg=-Wl,-S -C link-arg=-Wl,--build-id=none"
#Build
git clone --filter "blob:none" --quiet "https://github.com/pkgforge/soar" && cd "./soar"
echo -e "\n[+] Target: ${RUST_TARGET}\n"
echo -e "\n[+] Flags: ${RUSTFLAGS}\n"
sed "/^\[profile\.release\]/,/^$/d" -i "./Cargo.toml" ; echo -e "\n[profile.release]\nstrip = true\nopt-level = 3\nlto = true" >> "./Cargo.toml"
rm rust-toolchain* 2>/dev/null
cargo build --target "${RUST_TARGET}" --release --jobs="$(($(nproc)+1))" --keep-going
#Copy
find "./target/${RUST_TARGET}/release" -maxdepth 1 -type f -exec file -i "{}" \; | grep "application/.*executable" | cut -d":" -f1 | xargs realpath | xargs -I {} rsync -achvL "{}" "/build-bins/"
#Strip
find "/build-bins/" -type f -exec objcopy --remove-section=".comment" --remove-section=".note.*" "{}" \;
find "/build-bins/" -type f ! -name "*.no_strip" -exec strip --strip-debug --strip-dwo --strip-unneeded --preserve-dates "{}" \; 2>/dev/null
#Rename
find "/build-bins/" -type f ! -name "*.txt" -exec bash -c '\''mv "$0" "${0}-aarch64-Linux"'\'' {} \; 2>/dev/null
#UPX
find "/build-bins/" -type f | xargs realpath | xargs -I {} upx --best "{}" -f --force-overwrite -o"{}.upx" -qq 2>/dev/null
popd >/dev/null 2>&1
'
#Copy
sudo docker cp "alpine-builder:/build-bins/." "$(pwd)/"
find "." -maxdepth 1 -type f -exec sh -c 'file "{}"; du -sh "{}"' \;
sudo rsync -av --copy-links --exclude="*/" "./." "${ARTIFACTS}/"
sudo chown -R "$(whoami):$(whoami)" "${ARTIFACTS}" && chmod -R 755 "${ARTIFACTS}"
#End
sudo docker stop "alpine-builder" 2>/dev/null ; sudo docker rm "alpine-builder" 2>/dev/null
popd >/dev/null 2>&1
continue-on-error: true
- name: Archive Binaries (.tar)
run: |
#presets
set -x ; set +e
#-------------#
if [ -d "${ARTIFACTS}" ] && [ "$(find "${ARTIFACTS}" -mindepth 1 -print -quit 2>/dev/null)" ]; then
7z a -ttar -mx="9" -mmt="$(($(nproc)+1))" -bt "${ARTIFACTS}.tar" "${ARTIFACTS}" 2>/dev/null
sha256sum "${ARTIFACTS}.tar" && du -sh "${ARTIFACTS}.tar"
export HAS_RELEASE="TRUE"
echo "HAS_RELEASE=${HAS_RELEASE}" >> "${GITHUB_ENV}"
else
export HAS_RELEASE="FALSE"
echo "HAS_RELEASE=${HAS_RELEASE}" >> "${GITHUB_ENV}"
exit 1
fi
continue-on-error: true
- name: Upload_ARTIFACTS-aarch64-Linux
uses: actions/upload-artifact@v4
with:
name: ARTIFACTS-aarch64-Linux.tar
path: |
/tmp/ARTIFACTS-aarch64-Linux.tar
#------------------------------------------------------------------------------------#
create-release:
name: Create ARTIFACTS Release
runs-on: ubuntu-latest
needs: [build-x86_64-Linux, build-aarch64-Linux]
permissions: write-all
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
filter: "blob:none"
- name: Install CoreUtils & Deps
run: |
#presets
set -x ; set +e
#-------------#
export DEBIAN_FRONTEND="noninteractive"
sudo apt update -y -qq
sudo apt install 7zip b3sum bc binutils binutils-aarch64-linux-gnu coreutils curl dos2unix fdupes jq moreutils wget -y -qq
sudo apt-get install apt-transport-https apt-utils ca-certificates binutils binutils-aarch64-linux-gnu coreutils dos2unix fdupes gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux upx util-linux wget -y -qq 2>/dev/null ; sudo apt-get update -y 2>/dev/null
#Do again, sometimes fails
sudo apt install 7zip b3sum bc binutils binutils-aarch64-linux-gnu coreutils curl dos2unix fdupes jq moreutils wget -y -qq
sudo apt-get install apt-transport-https apt-utils ca-certificates binutils binutils-aarch64-linux-gnu coreutils dos2unix fdupes gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux upx util-linux wget -y -qq2>/dev/null ; sudo apt-get update -y 2>/dev/null
continue-on-error: true
- name: Install Addons
run: |
# Presets
set +x ; set +e
#--------------#
#https://github.com/Azathothas/Arsenal/blob/main/misc/Linux/install_dev_tools.sh
bash <(curl -qfsSL "https://pub.ajam.dev/repos/Azathothas/Arsenal/misc/Linux/install_dev_tools.sh")
continue-on-error: true
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: /tmp/RELEASES
- name: Extract Artifacts
run: |
#presets
set -x ; set +e
#-------------#
##list
cd "/tmp/RELEASES" && find "." -type f -name '*tar*' | xargs realpath
##extract
cd "/tmp/RELEASES" && find "." -type f -name '*tar*' | xargs -I {} tar -xvf {}
##ReAdd
find "." -type f -name '*aarch64-Linux*' ! -name '*.upx*' ! -name '*.tar' ! -name '*.xz' -print0 | xargs -0 tar --transform 's|.*/||' --transform 's/-aarch64-Linux//' -cvf "./aarch64-Linux.tar"
7z a -txz -mx="9" -mmt="$(($(nproc)+1))" -bt "./aarch64-Linux.tar.xz" "./aarch64-Linux.tar" 2>/dev/null
find "." -type f -name '*aarch64-Linux.upx*' ! -name '*.tar' ! -name '*.xz' -print0 | xargs -0 tar --transform 's|.*/||' --transform 's/-aarch64-Linux.upx//' -cvf "./aarch64-Linux.upx.tar"
7z a -txz -mx="9" -mmt="$(($(nproc)+1))" -bt "./aarch64-Linux.upx.tar.xz" "./aarch64-Linux.upx.tar" 2>/dev/null
find "." -type f -name '*x86_64-Linux*' ! -name '*.upx*' ! -name '*.tar' ! -name '*.xz' -print0 | xargs -0 tar --transform 's|.*/||' --transform 's/-x86_64-Linux//' -cvf "./x86_64-Linux.tar"
7z a -txz -mx="9" -mmt="$(($(nproc)+1))" -bt "./x86_64-Linux.tar.xz" "./x86_64-Linux.tar" 2>/dev/null
find "." -type f -name '*x86_64-Linux.upx*' ! -name '*.tar' ! -name '*.xz' -print0 | xargs -0 tar --transform 's|.*/||' --transform 's/-x86_64-Linux.upx//' -cvf "./x86_64-Linux.upx.tar"
7z a -txz -mx="9" -mmt="$(($(nproc)+1))" -bt "./x86_64-Linux.upx.tar.xz" "./x86_64-Linux.upx.tar" 2>/dev/null
##Move
find "." -type f ! -name '*.tar' ! -name '*.xz' -exec rsync -av --remove-source-files {} "./" 2>/dev/null \; 2>/dev/null
find "." -type d -empty -delete ; find "." -type f -name '*.sh' -delete
##clean
find "./" -maxdepth 1 -type f | sort | grep -v -E '\.tar$|\.txt$|\.xz$' | xargs file | sort -u -o "/tmp/RELEASES/FILE.txt"
find "./" -maxdepth 1 -type f | sort | grep -v -E '\.tar$|\.txt$|\.xz$' | xargs sha256sum | sort -u -o "/tmp/RELEASES/SHA256SUM.txt"
ls . -lah
continue-on-error: true
- name: Get Last Commit
run: |
#presets
set +x ; set +e
#-------------#
#UTC
pushd "$(mktemp -d)" >/dev/null 2>&1
git clone --filter "blob:none" --quiet "https://github.com/pkgforge/soar" && cd "./soar"
L_COMMIT="$(git log -1 --pretty="%B" | sed 's/[[:space:]]\+/_/g' | tr -d '[:space:]' | head -n 1)" && export L_COMMIT="${L_COMMIT}"
echo "L_COMMIT=${L_COMMIT}" >> "${GITHUB_ENV}"
popd >/dev/null 2>&1
continue-on-error: true
- name: Get DateTime
run: |
#presets
set +x ; set +e
#-------------#
#UTC
UTC_TIME="$(TZ='UTC' date +'%Y-%m-%d_%I:%M:%S_%p' | tr ' :-' '_')"
echo "UTC_TIME=${UTC_TIME}" >> "${GITHUB_ENV}"
continue-on-error: true
- name: Create Body for Release
run: |
#presets
set +x ; set +e
#-------------#
echo -e "" >> "/tmp/RELEASE_NOTE.md"
echo '---' >> "/tmp/RELEASE_NOTE.md"
echo '```console' >> "/tmp/RELEASE_NOTE.md"
echo -e "" >> "/tmp/RELEASE_NOTE.md"
echo -e "[+] --> Metadata (Version: ${UTC_TIME})" >> "/tmp/RELEASE_NOTE.md"
echo -e "" >> "/tmp/RELEASE_NOTE.md"
cat "/tmp/RELEASES/FILE.txt" >> "/tmp/RELEASE_NOTE.md"
echo -e "" >> "/tmp/RELEASE_NOTE.md"
echo -e "[+] --> SHA256SUM" >> "/tmp/RELEASE_NOTE.md"
echo -e "" >> "/tmp/RELEASE_NOTE.md"
cat "/tmp/RELEASES/SHA256SUM.txt" >> "/tmp/RELEASE_NOTE.md"
echo -e '```\n' >> "/tmp/RELEASE_NOTE.md"
echo -e "" >> "/tmp/RELEASE_NOTE.md"
continue-on-error: true
#continuous
- name: Releaser
uses: softprops/[email protected]
with:
name: "soar-@latest"
tag_name: "continuous"
prerelease: true
draft: false
generate_release_notes: false
body_path: "/tmp/RELEASE_NOTE.md"
files: |
/tmp/RELEASES/*
continue-on-error: true
#Snapshot
- name: Releaser
uses: softprops/[email protected]
with:
name: "ARTIFACTS_${{ env.L_COMMIT }}"
tag_name: "${{ env.UTC_TIME }}"
prerelease: false
draft: false
generate_release_notes: false
body_path: "/tmp/RELEASE_NOTE.md"
make_latest: false
files: |
/tmp/RELEASES/*
continue-on-error: true
#------------------------------------------------------------------------------------#