-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (98 loc) · 4.2 KB
/
schedule_builds.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
name: ⏱️ Schedule Matrix Builds 📈
on:
workflow_dispatch:
jobs:
pre-trigger-build:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
build_list: ${{ steps.set-inputs.outputs.build_list }}
steps:
- name: Setup Env
run: |
##presets
set +x ; set +e
#-------------#
##CoreUtils
sudo apt update -y
sudo apt install bc coreutils curl dos2unix fdupes jq moreutils wget -y
sudo apt-get install apt-transport-https apt-utils ca-certificates coreutils dos2unix gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux util-linux wget -y 2>/dev/null ; sudo apt-get update -y 2>/dev/null
#-------------#
##Host
HOST_TRIPLET="$(uname -m)-$(uname -s)"
echo "HOST_TRIPLET=${HOST_TRIPLET}" >> "${GITHUB_ENV}"
#-------------#
##Repo
PKG_REPO="${GITHUB_REPOSITORY}"
echo "PKG_REPO=${PKG_REPO#*/}" >> "${GITHUB_ENV}"
#-------------#
##tmp
SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}"
echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}"
#-------------#
mkdir -p "${HOME}/bin"
sudo apt update -y
sudo apt install dos2unix -y
##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: Get & Set Inputs
id: set-inputs
run: |
##presets
set +x ; set +e
#-------------#
##Get Data
mkdir -pv "${SYSTMP}/pkgforge"
curl -w "(Diff) <== %{url}\n" -qfsSL "https://raw.githubusercontent.com/pkgforge/metadata/refs/heads/main/soarpkgs/data/DIFF_${PKG_REPO}_${HOST_TRIPLET}.json" -o "${SYSTMP}/pkgforge/DIFF.json.tmp"
curl -w "(List) <== %{url}\n" "https://raw.githubusercontent.com/pkgforge/${PKG_REPO}/refs/heads/main/SBUILD_LIST.json" -o "${SYSTMP}/pkgforge/SBUILD_LIST.json.tmp"
jq -n --slurpfile a "${SYSTMP}/pkgforge/DIFF.json.tmp" --slurpfile b "${SYSTMP}/pkgforge/SBUILD_LIST.json.tmp" \
'
[$b[] | .[] as $objB |
($a[] | .[] | .build_script | split("/") | .[-3:] | join("/")) as $a_last3 |
($objB.build_script | split("/") | .[-3:] | join("/")) as $b_last3 |
if $a_last3 == $b_last3 or $objB.rebuild == true then $objB else empty end
] | unique_by(.ghcr_pkg) | sort_by(.pkg_family)
' | jq . > "${SYSTMP}/pkgforge/SBUILD_LIST.json"
##Set Input (100 builds)
BUILD_LIST="$(jq -c '[.[] | select(._disabled == false) | {pkg_family, ghcr_url: .ghcr_pkg, sbuild_url: .build_script, rebuild}] | .[:100]' "${SYSTMP}/pkgforge/SBUILD_LIST.json")"
##Validate Input
if jq -e . <<<"${BUILD_LIST}" >/dev/null 2>&1; then
echo "build_list=$(echo "${BUILD_LIST}" | jq -c .)" >> "${GITHUB_OUTPUT}"
else
echo -e "\n[-] Input Json is likely Invalid\n"
echo "${BUILD_LIST}" | jq .
exit 1
fi
continue-on-error: false
trigger-build:
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
statuses: write
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.pre-trigger-build.outputs.build_list || '[]') }}
steps:
- name: Trigger Matrix Builds
env:
GH_TOKEN: "${{ github.token }}"
run: |
##presets
set +x ; set +e
#-------------#
gh workflow run "matrix_builds.yaml" \
--repo "${GITHUB_REPOSITORY}" \
--ref "${GITHUB_REF}" \
-f host="ALL" \
-f sbuild-url="${{ matrix.package.sbuild_url }}" \
-f ghcr-url="${{ matrix.package.ghcr_url }}" \
-f pkg-family="${{ matrix.package.pkg_family }}" \
-f debug="false" \
-f logs="true" \
-f rebuild="${{ matrix.package.rebuild }}"
continue-on-error: false