This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
ποΈ (arm64-v8a Android) Generate | Update βοΈ Daily Package π¦ Metadata ποΈ #9289
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: ποΈ (arm64-v8a Android) Generate | Update βοΈ Daily Package π¦ Metadata ποΈ | |
#MAX_RUNTIME: | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "*/35 * * * *" # Every 35 Mins | |
env: | |
GITHUB_TOKEN: ${{ secrets.HYSP_TOKEN }} | |
jobs: | |
#------------------------------------------------------------------------------------# | |
#------------------------------------------------------------------------------------# | |
fetch-meta: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
path: main | |
- name: Install CoreUtils & Deps | |
run: | | |
#Presets | |
set +x ; set +e | |
#--------------# | |
sudo apt-get update -y | |
sudo apt-get install coreutils ca-certificates curl git dos2unix lzip jq moreutils p7zip-full util-linux wget -y | |
pip install ansi2txt --upgrade | |
#Re | |
sudo apt-get install coreutils ca-certificates curl git dos2unix lzip jq moreutils p7zip-full util-linux wget -y | |
pip install ansi2txt --upgrade | |
continue-on-error: true | |
- name: Install Addons | |
run: | | |
#Presets | |
set +x ; set +e | |
#--------------# | |
#action-lint | |
sudo curl -qfsSL "https://bin.ajam.dev/x86_64_Linux/actionlint" -o "/usr/local/bin/actionlint" && sudo chmod +xwr "/usr/local/bin/actionlint" | |
#delta | |
sudo curl -qfsSL "https://bin.ajam.dev/x86_64_Linux/delta" -o "/usr/local/bin/delta" && sudo chmod +xwr "/usr/local/bin/delta" | |
#eget | |
sudo curl -qfsSL "https://bin.ajam.dev/x86_64_Linux/eget" -o "/usr/local/bin/eget" && sudo chmod +xwr "/usr/local/bin/eget" | |
#validtoml | |
sudo curl -qfsSL "https://bin.ajam.dev/x86_64_Linux/validtoml" -o "/usr/local/bin/validtoml" && sudo chmod +xwr "/usr/local/bin/validtoml" | |
#Yq | |
sudo curl -qfsSL "https://bin.ajam.dev/x86_64_Linux/yq" -o "/usr/local/bin/yq" && sudo chmod +xwr "/usr/local/bin/yq" | |
#Yj | |
sudo curl -qfsSL "https://bin.ajam.dev/x86_64_Linux/yj" -o "/usr/local/bin/yj" && sudo chmod +xwr "/usr/local/bin/yj" | |
continue-on-error: true | |
- name: Setup Env | |
run: | | |
# Create Output Dir | |
mkdir -p "$GITHUB_WORKSPACE/main/data/arm64_v8a_Android" | |
continue-on-error: true | |
#------------------------------------------------------------------------------------# | |
- name: Generate Meta ("bin.ajam.dev/arm64_v8a_Android/METADATA.json") | |
run: | | |
#Presets | |
set +x ; set +e | |
#--------------# | |
#Get Json | |
curl -qfsSL "https://bin.ajam.dev/arm64_v8a_Android/METADATA.json" -o "/tmp/METADATA.json" | |
#Sanity Check | |
if [ -s "/tmp/METADATA.json" ] && jq -e 'map(select(.repo_url != null and .repo_url != "" or .web_url != null and .web_url != "")) | length > 0' "/tmp/METADATA.json" >/dev/null 2>&1; then | |
#Get All Bins | |
readarray -t objs < <(jq 'map(select(.repo_url != null and .repo_url != "" or .web_url != null and .web_url != ""))' /tmp/METADATA.json | jq -c '.[]') | |
for obj in "${objs[@]}"; do | |
#Extract the Name and Repo from the JSON object | |
bin="$(jq -r '.name' <<< "$obj" | sed 's/\s//g' | tr -d '[:space:]')" && export bin="$bin" | |
repo="$(jq -r '.repo_url' <<< "$obj" | tr -d '[:space:]')" && export repo="$repo" | |
web="$(jq -r '.web_url' <<< "$obj" | tr -d '[:space:]')" && export web="$web" | |
# Set up the environment variables and execute the one-liner | |
echo -e "\n\n[+] Generating Meta for $bin ($repo || $web)\n" | |
BIN="$bin" REPO_URL="$repo" WEB_URL="$web" bash <(curl -qfsSL "https://raw.githubusercontent.com/metis-os/hysp-pkgs/main/.github/scripts/pkg_metafetcher_aarch64_arm64_v8a_Android_bin.ajam.dev.sh") | |
#unset vars | |
unset bin repo web | |
done | |
fi | |
continue-on-error: true | |
#------------------------------------------------------------------------------------# | |
- name: Dos2Unix Everything | |
run: | | |
cd "$GITHUB_WORKSPACE/main/data/arm64_v8a_Android/" | |
find . -type f -exec dos2unix {} \; | |
continue-on-error: true | |
- name: Git Pull | |
run: | | |
cd "$GITHUB_WORKSPACE/main" && git pull origin main | |
continue-on-error: true | |
- name: Validate TOML | |
run: | | |
#Presets | |
set +x ; set +e | |
#--------------# | |
cd "$GITHUB_WORKSPACE/main/data" | |
## Just list | |
#find "$GITHUB_WORKSPACE/main/data" -type f -name '*.toml' ! -name '*SAMPLE_SPEC*' -exec yq --input-format "toml" --output-format "yaml" {} 1>/dev/null \; | |
# List & Delete | |
find "$GITHUB_WORKSPACE/main/data" -type f -name '*.toml' ! -name '*SAMPLE_SPEC*' -exec sh -c 'yq --input-format "toml" --output-format "yaml" "$1" 1>/dev/null || rm "$1"' _ {} \; | |
continue-on-error: true | |
- name: Validate source | |
run: | | |
#Presets | |
set +x ; set +e | |
#--------------# | |
cd "$GITHUB_WORKSPACE/main/data" | |
## Just list | |
find "$GITHUB_WORKSPACE/main/data" -type f -name '*.toml' ! -name '*SAMPLE_SPEC*' -exec yq --input-format "toml" --output-format "json" {} 2>/dev/null \; | jq -r 'select(.package.source == "") | .package.architecture + " β― " + .package.name + " β " + .package.source' | sort -u | |
echo -e "\n----------------------------\n" | |
find "$GITHUB_WORKSPACE/main/data" -type f -name '*.toml' ! -name '*SAMPLE_SPEC*' -exec sh -c 'yq --input-format "toml" --output-format "json" "$1" 2>/dev/null | jq -r --arg workspace "$GITHUB_WORKSPACE" '\''select(.package.source == "") | $workspace + "/main/data/" + .package.architecture + "/" + .package.name + ".toml"'\'' ' _ {} \; | |
#Delete | |
echo -e "\n----------------------------\n" | |
find "$GITHUB_WORKSPACE/main/data" -type f -name '*.toml' ! -name '*SAMPLE_SPEC*' -exec sh -c 'yq --input-format "toml" --output-format "json" "$1" 2>/dev/null | jq -r --arg workspace "$GITHUB_WORKSPACE" '\''select(.package.source == "") | $workspace + "/main/data/" + .package.architecture + "/" + .package.name + ".toml"'\'' ' _ {} \; | xargs rm 2>/dev/null | |
continue-on-error: true | |
- name: Update Available Index (JSON || TOML) | |
run: | | |
#Presets | |
set -x ; set +e ; ulimit -S -s unlimited | |
#--------------# | |
cd "$GITHUB_WORKSPACE/main" | |
#Update $GITHUB_WORKSPACE/main/data/metadata.toml | |
##arm64_v8a_Android | |
awk '/^\[package\]/ {print "[[packages]]"; in_package = 1; next} /^\[package\.conditions\]/ {in_package = 0; next} in_package {print $0}' $GITHUB_WORKSPACE/main/data/arm64_v8a_Android/*.toml | tee "$GITHUB_WORKSPACE/main/data/metadata.toml" | |
##aarch64_arm64 | |
awk '/^\[package\]/ {print "[[packages]]"; in_package = 1; next} /^\[package\.conditions\]/ {in_package = 0; next} in_package {print $0}' $GITHUB_WORKSPACE/main/data/aarch64_arm64/*.toml | tee -a "$GITHUB_WORKSPACE/main/data/metadata.toml" | |
##x86_64 | |
awk '/^\[package\]/ {print "[[packages]]"; in_package = 1; next} /^\[package\.conditions\]/ {in_package = 0; next} in_package {print $0}' $GITHUB_WORKSPACE/main/data/x86_64/*.toml | tee -a "$GITHUB_WORKSPACE/main/data/metadata.toml" | |
##x64_Windows | |
awk '/^\[package\]/ {print "[[packages]]"; in_package = 1; next} /^\[package\.conditions\]/ {in_package = 0; next} in_package {print $0}' $GITHUB_WORKSPACE/main/data/x64_Windows/*.toml | tee -a "$GITHUB_WORKSPACE/main/data/metadata.toml" | |
#Update $GITHUB_WORKSPACE/main/data/metadata.json | |
cat "$GITHUB_WORKSPACE/main/data/metadata.toml" | yj -tj | jq . | tee "$GITHUB_WORKSPACE/main/data/metadata.json" | |
continue-on-error: true | |
- name: Generate Markdown (No Table --> ./data/arm64_v8a_Android.md) | |
run: | | |
#Presets | |
set -x ; set +e ; ulimit -S -s unlimited | |
#--------------# | |
cd "$GITHUB_WORKSPACE/main" | |
#Generate $GITHUB_WORKSPACE/main/data/arm64_v8a_Android/README.md | |
cat "$GITHUB_WORKSPACE/main/data/metadata.json" | jq -r '.packages[] | select(.architecture == "arm64_v8a_Android") | "### \(.name)\n- **Description:** \(.description)\n- **Author:** \(.author)\n- **Repository:** [\(.repo)](\(.repo))\n- **Stars:** \(.stars)\n- **Version:** \(.version)\n- **Updated:** \(.updated)\n- **Size:** \(.size)\n- **SHASUM:** \(.sha)\n- **B3SUM:** \(.bsum)\n- **Source:** \(.source)\n- **Language:** \(.language)\n- **License:** \(.license)\n\n---\n"' > "$GITHUB_WORKSPACE/main/data/arm64_v8a_Android.md" | |
continue-on-error: true | |
- name: Generate Markdown (Table --> ./data/arm64_v8a_Android/README.md) | |
run: | | |
#Presets | |
set -x ; set +e ; ulimit -S -s unlimited | |
#--------------# | |
cd "$GITHUB_WORKSPACE/main" | |
#Generate $GITHUB_WORKSPACE/main/data/arm64_v8a_Android/README.md | |
{ echo "| Name | Description | Author | Repository | Stars | Version | Updated | Size | SHA256SUM | B3SUM | Source | Language | License |" ; echo "| ---- | ----------- | ------ | ---------- | ----- | ------- | ------- | ---- | --- | ------ | --------|-------- | ------- |" ; cat $GITHUB_WORKSPACE/main/data/metadata.json | jq -r '.packages[] | select(.architecture == "arm64_v8a_Android") | "| \(.name) | \(.description) | \(.author) | [\(.repo)](\(.repo)) | \(.stars) | \(.version) | \(.updated) | \(.size) | \(.sha) | \(.bsum) | \(.source) | \(.language) | \(.license) |"' ; } | tee "$GITHUB_WORKSPACE/main/data/arm64_v8a_Android/README.md" | |
continue-on-error: true | |
- name: Generate Markdown ( Main README.md) | |
run: | | |
#Presets | |
set -x ; set +e ; ulimit -S -s unlimited ; ulimit -f unlimited 2>/dev/null | |
#--------------# | |
cd "$GITHUB_WORKSPACE/main" | |
#Generate $GITHUB_WORKSPACE/main/README.md | |
cat "$GITHUB_WORKSPACE/main/INFO.md" > "$GITHUB_WORKSPACE/main/README.md" | |
#aarch64_arm64 | |
unset TOTAL_PACKAGES | |
TOTAL_PACKAGES="$(cat "$GITHUB_WORKSPACE/main/data/metadata.json" | jq -r '.packages[] | select(.architecture == "aarch64_arm64")' | jq -r '.name' | sort -u | wc -l)" && export TOTAL_PACKAGES="$TOTAL_PACKAGES" | |
sed "s/PLACEHOLDER_aarch64_arm64/$TOTAL_PACKAGES/g" -i "$GITHUB_WORKSPACE/main/README.md" | |
#x86_64 | |
unset TOTAL_PACKAGES | |
TOTAL_PACKAGES="$(cat "$GITHUB_WORKSPACE/main/data/metadata.json" | jq -r '.packages[] | select(.architecture == "x86_64")' | jq -r '.name' | sort -u | wc -l)" && export TOTAL_PACKAGES="$TOTAL_PACKAGES" | |
sed "s/PLACEHOLDER_X86_64/$TOTAL_PACKAGES/g" -i "$GITHUB_WORKSPACE/main/README.md" | |
#x64_Windows | |
unset TOTAL_PACKAGES | |
export TOTAL_PACKAGES="$(cat "$GITHUB_WORKSPACE/main/data/metadata.json" | jq -r '.packages[] | select(.architecture == "x64_Windows")' | jq -r '.name' | sort -u | wc -l)" && export TOTAL_PACKAGES="$TOTAL_PACKAGES" | |
sed "s/PLACEHOLDER_x64_Windows/$TOTAL_PACKAGES/g" -i "$GITHUB_WORKSPACE/main/README.md" | |
continue-on-error: true | |
- name: Generate Diff (Delta) | |
run: | | |
#Presets | |
set +x ; set +e | |
#--------------# | |
cd "$GITHUB_WORKSPACE/main" | |
#aarch64_arm64 | |
echo -e "[+] aarch64_arm64\n" > "$GITHUB_WORKSPACE/main/.github/PKGS_DIFF.txt" | |
delta -s --raw <(curl -qfsSL "https://bin.ajam.dev/aarch64_arm64_Linux/METADATA.json" | jq -r '.[].name' | grep -v "\.7z$\|\.bz2$\|\.json$\|\.gz$\|\.md$\|\.txt$\|\.tar$\|\.zip$" | sort -u) <(curl -qfsSL "https://raw.githubusercontent.com/metis-os/hysp-pkgs/main/data/metadata.json" | jq -r '.packages[] | select(.architecture == "aarch64_arm64")' | jq -r '.name' | sort -u) | ansi2txt | grep -iv "^/proc" | grep '\|' | grep -iv '@\|BLAKE3SUM\|README.md\|SHA256SUM' | grep -iv '/dev/fd' | tee -a "$GITHUB_WORKSPACE/main/.github/PKGS_DIFF.txt" | |
#x86_64 | |
echo -e "\n\n[+] x86_64\n" >> "$GITHUB_WORKSPACE/main/.github/PKGS_DIFF.txt" | |
delta -s --raw <(curl -qfsSL "https://bin.ajam.dev/x86_64_Linux/METADATA.json" | jq -r '.[].name' | grep -v "\.7z$\|\.bz2$\|\.json$\|\.gz$\|\.md$\|\.txt$\|\.tar$\|\.zip$" | sort -u) <(curl -qfsSL "https://raw.githubusercontent.com/metis-os/hysp-pkgs/main/data/metadata.json" | jq -r '.packages[] | select(.architecture == "x86_64")' | jq -r '.name' | sort -u) | ansi2txt | grep -iv "^/proc" | grep '\|' | grep -iv '@\|BLAKE3SUM\|README.md\|SHA256SUM' | grep -iv '/dev/fd' | tee -a "$GITHUB_WORKSPACE/main/.github/PKGS_DIFF.txt" | |
#Only Missing | |
#aarch64_arm64 | |
cat "$GITHUB_WORKSPACE/main/.github/PKGS_DIFF.txt" | grep -A 9999999999999 "aarch64_arm64" 2>/dev/null | awk '/x86_64/{exit} {print}' 2>/dev/null | grep -E "^\s*\β.*β\s*$" | awk -F'β' '{if($2 ~ /^ *$/ || $4 ~ /^ *$/) print}' | tee "$GITHUB_WORKSPACE/main/.github/PKGS_DIFF_aarch64_arm64.txt" | |
#x86_64 | |
cat "$GITHUB_WORKSPACE/main/.github/PKGS_DIFF.txt" | grep -A 9999999999999 "x86_64" 2>/dev/null | grep -E "^\s*\β.*β\s*$" | awk -F'β' '{if($2 ~ /^ *$/ || $4 ~ /^ *$/) print}' | tee "$GITHUB_WORKSPACE/main/.github/PKGS_DIFF_x86_64.txt" | |
#x64_Windows | |
cat "$GITHUB_WORKSPACE/main/.github/PKGS_DIFF.txt" | grep -A 9999999999999 "x64_Windows" 2>/dev/null | grep -E "^\s*\β.*β\s*$" | awk -F'β' '{if($2 ~ /^ *$/ || $4 ~ /^ *$/) print}' | tee "$GITHUB_WORKSPACE/main/.github/PKGS_DIFF_x64_Windows.txt" | |
continue-on-error: true | |
- name: Get DateTime | |
run: | | |
# Date Time | |
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 # defaults to "github-actions[bot]" | |
commit_user_email: AjamX101@gmail.com # defaults to "41898282+github-actions[bot]@users.noreply.github.com" | |
commit_message: "β ποΈ (arm64-v8a Android) Generated | Updated βοΈ Daily Package π¦ Metadata ποΈ <-- ${{ env.NEPALI_TIME }} β" | |
#push_options: '--force' | |
#------------------------------------------------------------------------------------# |