-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (187 loc) · 7.77 KB
/
generate.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
name: ♻️ Generate Metadata ♻️
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
on:
workflow_dispatch:
schedule:
# - cron: "0 3 * * *" #UTC 03:00 AM --> 08:45 AM NPT @everyday
- cron: "0 */6 * * *" #every 6 hrs
jobs:
generate:
runs-on: ubuntu-latest
timeout-minutes: 200
permissions:
attestations: write
contents: write
id-token: write
issues: write
packages: write
statuses: read
strategy:
matrix:
include:
- repo: "bincache"
script: "${GITHUB_WORKSPACE}/main/bincache/scripts/gen_meta_aarch64-Linux.sh"
arch: "aarch64"
file: "/tmp/bincache_aarch64-Linux.json"
- repo: "bincache"
script: "${GITHUB_WORKSPACE}/main/bincache/scripts/gen_meta_x86_64-Linux.sh"
arch: "x86_64"
file: "/tmp/bincache_x86_64-Linux.json"
- repo: "soarpkgs"
script: "${GITHUB_WORKSPACE}/main/soarpkgs/scripts/gen_meta.sh"
arch: "MULTI"
file: "/tmp/INDEX.json"
- repo: "soarpkgs"
script: "${GITHUB_WORKSPACE}/main/soarpkgs/scripts/gen_ghcr_backage.sh"
arch: "MULTI"
file: "/tmp/BACKAGE.json"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
filter: "blob:none"
- name: Install Addons
run: |
#presets
set +x ; set +e
#-------------#
bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_bins_curl.sh")
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}"
#-------------#
#GH Dirs
mkdir -pv "${GITHUB_WORKSPACE}/main/bincache/data"
mkdir -pv "${GITHUB_WORKSPACE}/main/misc/data"
mkdir -pv "${GITHUB_WORKSPACE}/main/pkgcache/data"
mkdir -pv "${GITHUB_WORKSPACE}/main/soarpkgs/data"
#-------------#
##rclone
echo "${{ secrets.CF_META }}" > "${HOME}/.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: Generate (${{ matrix.repo }}/${{ matrix.arch }})
env:
#GITHUB_TOKEN: "${{ github.token }}"
GITHUB_TOKEN: "${{ secrets.RO_GHTOKEN }}"
run: |
#presets
set +x ; set +e
#-------------#
dos2unix --quiet "${{ matrix.script }}"
chmod +x "${{ matrix.script }}"
#PARALLEL_LIMIT="50" bash "${{ matrix.script }}"
PARALLEL_LIMIT="$(($(nproc)+1))" bash "${{ matrix.script }}"
continue-on-error: true
- name: Get DateTime & Purge files (=> 95 MB)
run: |
#Presets
set +x ; set +e
#--------------#
UTC_TIME="$(TZ='UTC' date +'%Y-%m-%d (%I:%M:%S %p)')"
echo "UTC_TIME=${UTC_TIME}" >> "${GITHUB_ENV}"
#Sync
cd "${GITHUB_WORKSPACE}/main"
git pull origin main --no-edit 2>/dev/null
#Purge
find "${GITHUB_WORKSPACE}/main" -path "${GITHUB_WORKSPACE}/main/.git" -prune -o -type f -size +95M -exec rm -rvf "{}" + 2>/dev/null
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: "✅ Updated Metadata [${{ matrix.repo }}-${{ matrix.arch }}] ♻️"
#push_options: '--force'
continue-on-error: true
- name: Report Invalid SBUILDS
run: |
#Presets
set +x ; set +e
#--------------#
##Failed SBUILDS (Binaries)
if [[ -s "${SYSTMP}/INVALID_BINARIES.txt" || $(stat -c%s "${SYSTMP}/INVALID_BINARIES.txt") -gt 10 ]]; then
#sed 's|.*/binaries|https://github.com/pkgforge/soarpkgs/blob/main/binaries|' -i "${SYSTMP}/INVALID_BINARIES.txt"
#sed 's|^|- |' -i "${SYSTMP}/INVALID_BINARIES.txt"
#sort -u "${SYSTMP}/INVALID_BINARIES.txt" -o "${SYSTMP}/INVALID_BINARIES.txt"
export HAS_INVALID_BINS="TRUE"
echo "HAS_INVALID_BINS=${HAS_INVALID_BINS}" >> "${GITHUB_ENV}"
fi
##Failed SBUILDS (Packages)
if [[ -s "${SYSTMP}/INVALID_PACKAGES.txt" || $(stat -c%s "${SYSTMP}/INVALID_PACKAGES.txt") -gt 10 ]]; then
#sed 's|.*/packages|https://github.com/pkgforge/soarpkgs/blob/main/packages|' -i "${SYSTMP}/INVALID_PACKAGES.txt"
#sed 's|^|- |' -i "${SYSTMP}/INVALID_PACKAGES.txt"
#sort -u "${SYSTMP}/INVALID_PACKAGES.txt" -o "${SYSTMP}/INVALID_PACKAGES.txt"
export HAS_INVALID_PKGS="TRUE"
echo "HAS_INVALID_PKGS=${HAS_INVALID_PKGS}" >> "${GITHUB_ENV}"
fi
continue-on-error: true
- name: Create Issue (Invalid Binary SBUILDS)
if: env.HAS_INVALID_BINS == 'TRUE'
uses: peter-evans/create-issue-from-file@v5
with:
title: SBUILDS (Failed Binary Validation)
content-filepath: "/tmp/INVALID_BINARIES.txt"
labels: report, automated issue
continue-on-error: true
- name: Create Issue (Invalid Package SBUILDS)
if: env.HAS_INVALID_PKGS == 'TRUE'
uses: peter-evans/create-issue-from-file@v5
with:
title: SBUILDS (Failed Package Validation)
content-filepath: "/tmp/INVALID_PACKAGES.txt"
labels: report, automated issue
continue-on-error: true
- name: Report Duplicate pkg_webpages
run: |
if [[ -s "${SYSTMP}/DUPES_PKG_WEBPAGE.json" || $(stat -c%s "${SYSTMP}/DUPES_PKG_WEBPAGE.json") -gt 10 ]]; then
echo '```json' > "${SYSTMP}/DUPES_PKG_WEBPAGE.txt"
cat "${SYSTMP}/DUPES_PKG_WEBPAGE.json" >> "${SYSTMP}/DUPES_PKG_WEBPAGE.txt"
echo '```' >> "${SYSTMP}/DUPES_PKG_WEBPAGE.txt"
export HAS_DUPE_PKG_WEBPAGES="TRUE"
fi
continue-on-error: true
- name: Create Issue (Duplicate Webpages)
if: env.HAS_DUPE_PKG_WEBPAGES == 'TRUE'
uses: peter-evans/create-issue-from-file@v5
with:
title: SBUILDS (Duplicate Webpages)
content-filepath: "/tmp/DUPES_PKG_WEBPAGE.txt"
labels: report, automated issue
continue-on-error: true
- name: Report Missing pkg_id
run: |
if [[ -s "${SYSTMP}/MISSING_PKG_ID.json" || $(stat -c%s "${SYSTMP}/MISSING_PKG_ID.json") -gt 10 ]]; then
echo '```json' > "${SYSTMP}/MISSING_PKG_ID.txt"
cat "${SYSTMP}/MISSING_PKG_ID.json" >> "${SYSTMP}/MISSING_PKG_ID.txt"
echo '```' >> "${SYSTMP}/MISSING_PKG_ID.txt"
export HAS_MISSING_PKG_ID="TRUE"
fi
continue-on-error: true
- name: Create Issue (Missing Package ID)
if: env.HAS_MISSING_PKG_ID == 'TRUE'
uses: peter-evans/create-issue-from-file@v5
with:
title: SBUILDS (Missing Package ID)
content-filepath: "/tmp/MISSING_PKG_ID.txt"
labels: report, automated issue
continue-on-error: true
- name: Attest Build Provenance
uses: actions/[email protected]
with:
subject-name: "metadata-${{ matrix.repo }}-${{ matrix.arch }}"
subject-path: "${{ matrix.file }}"
show-summary: true
continue-on-error: true