♻️ Generate Metadata ♻️ #64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |