Skip to content

Commit

Permalink
notify loonix
Browse files Browse the repository at this point in the history
  • Loading branch information
Azathothas authored Nov 17, 2024
1 parent 72012d5 commit 0bd0a94
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions .github/workflows/build_aarch64_Linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
#Sane env
env:
GITHUB_TOKEN: "${{ secrets.TOOLPACKS }}"
PKGFORGE_LOONIX_TOKEN: "${{ secrets.PKGFORGE_LOONIX_TOKEN }}"
RCLONE_CF_R2_PUB: "${{ secrets.RCLONE_CF_R2_PUB }}"
TSKEY: "${{ secrets.TSKEY }}"
UPX_PACK: "YES"
Expand Down Expand Up @@ -97,14 +98,14 @@ jobs:
#Upload to Pub
echo -e "[+] Syncing $GITHUB_REPOSITORY to pub.ajam.dev/repos/$GITHUB_REPOSITORY \n"
rclone sync "." "r2:/pub/repos/$GITHUB_REPOSITORY/" --user-agent="$USER_AGENT" --buffer-size="10M" --s3-upload-concurrency="50" --s3-chunk-size="10M" --multi-thread-streams="50" --checkers="2000" --transfers="100" --retries="10" --check-first --checksum --copy-links --fast-list --progress
##Scripts_x86_64_Linux
##Scripts_aarch64_Linux
#Get JQ Module to convert size : https://users.aalto.fi/~tontti/posts/jq-and-human-readable-bytes/
curl -qfsSL "https://pub.ajam.dev/utils/devscripts/jq/to_human_bytes.jq" -o "./to_human_bytes.jq"
rclone lsjson --fast-list "r2:/pub/repos/Azathothas/Toolpacks/.github/scripts/x86_64_Linux/bins/" --exclude="*.yaml" | jq -r 'include "./to_human_bytes" ; .[] | select(.IsDir == false) | {name: (.Name), update_date: (.ModTime | split(".")[0]), source_url: "https://pub.ajam.dev/repos/Azathothas/Toolpacks/.github/scripts/x86_64_Linux/bins/\(.Path)"}' | jq . > "./metadata.json.tmp"
rclone lsjson --fast-list "r2:/pub/repos/Azathothas/Toolpacks/.github/scripts/aarch64_Linux/bins/" --exclude="*.yaml" | jq -r 'include "./to_human_bytes" ; .[] | select(.IsDir == false) | {name: (.Name), update_date: (.ModTime | split(".")[0]), source_url: "https://pub.ajam.dev/repos/Azathothas/Toolpacks/.github/scripts/aarch64_Linux/bins/\(.Path)"}' | jq . > "./metadata.json.tmp"
#Clean Pretty Formatted
echo "[" $(cat metadata.json.tmp | tr '\n' ' ' | sed 's/}/},/g' | sed '$ s/,$//') "]" | sed '$s/,[[:space:]]*\]/\]/' | jq . | tee "./metadata.json"
#Update Metadata
rclone copyto --checksum "./metadata.json" "r2:/pub/repos/Azathothas/Toolpacks/.github/scripts/x86_64_Linux/bins/metadata.json"
rclone copyto --checksum "./metadata.json" "r2:/pub/repos/Azathothas/Toolpacks/.github/scripts/aarch64_Linux/bins/metadata.json"
continue-on-error: true
#------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------#
Expand Down Expand Up @@ -202,6 +203,19 @@ jobs:
sudo tailscale serve --bg="true" --yes="true" --set-path "/btop" "http://127.0.0.1:7777"
echo -e "\n\n[+] Tmux TTY: http://$TS_DNS:7070 || https://$TS_DNS/tmux/"
echo -e "[+] BTOP: http://$TS_DNS:7777 || https://$TS_DNS/btop/\n"
##Loonix (Start)
GH_EVENT="${{ github.event_name }}"
START_TIME="$(date +%s)" && export START_TIME
echo "GH_EVENT=${GH_EVENT}" >> "${GITHUB_ENV}"
echo "START_TIME=${START_TIME}" >> "${GITHUB_ENV}"
rm -rvf "/tmp/PKGFORGE_LOONIX.html" 2>/dev/null
echo -e "ℹ️ <b>Triggered</b> <a href='https://github.com/Azathothas/Toolpacks/blob/main/.github/workflows/build_aarch64_Linux.yaml'><b>🛍️ Build 📦 Bincache (ToolPacks) 📦🗄️</b></a> <a href='https://github.com/Azathothas/Toolpacks'><b>Azathothas/Toolpacks (aarch64-Linux)</b></a> [<b><u>$(date --utc +'%Y-%m-%dT%H:%M:%S.%3N') UTC</u></b>]" > "/tmp/PKGFORGE_LOONIX.html"
echo -e "<b><u>Event</u></b>: <code>${GH_EVENT}</code>" >> "/tmp/PKGFORGE_LOONIX.html"
echo -e "<b><u>Btop</u></b>: https://${TS_DNS}/btop/" >> "/tmp/PKGFORGE_LOONIX.html"
echo -e "<b><u>Tmux</u></b>: https://${TS_DNS}/tmux/" >> "/tmp/PKGFORGE_LOONIX.html"
echo -e "<b><u>GH Repo</u></b>: https://github.com/${GITHUB_REPOSITORY}" >> "/tmp/PKGFORGE_LOONIX.html"
echo -e "<b><u>Maintainer</u></b>: @Azathothas" >> "/tmp/PKGFORGE_LOONIX.html"
curl "https://api.telegram.org/bot${PKGFORGE_LOONIX_TOKEN}/sendMessage" -d "chat_id=-1002007583969&message_thread_id=63949" -d "text=$(cat /tmp/PKGFORGE_LOONIX.html)" -d "parse_mode=html"
set +x ; while tmux has-session -t "toolpacks" ; do sleep 1 ; done
##Purge Tokens (in case set -x & gh didn't redact)
cat "$SYSTMP/BUILD.log" | ansi2txt > "$SYSTMP/BUILD.log.tmp.txt"
Expand All @@ -228,6 +242,25 @@ jobs:
rclone copyto "$SYSTMP/BUILD_FAILED.log" "r2:/bin/aarch64_arm64_Linux/BUILD_FAILED.log.txt" --user-agent="$USER_AGENT" --buffer-size="100M" --s3-upload-concurrency="500" --s3-chunk-size="100M" --multi-thread-streams="500" --checkers="2000" --transfers="1000" --retries="10" --check-first --checksum --copy-links --fast-list --progress
rclone copyto "$SYSTMP/BUILD.BIN.log" "r2:/bin/aarch64_arm64_Linux/BUILD.BIN.log.txt" --user-agent="$USER_AGENT" --buffer-size="100M" --s3-upload-concurrency="500" --s3-chunk-size="100M" --multi-thread-streams="500" --checkers="2000" --transfers="1000" --retries="10" --check-first --checksum --copy-links --fast-list --progress
continue-on-error: true

- name: Notify Loonix (END)
run: |
##presets
set +x ; set +e
#-------------#
END_TIME="$(date +%s)" && export END_TIME="${END_TIME}"
ELAPSED_TIME="$(date -u -d@"$((END_TIME - START_TIME))" "+%H(Hr):%M(Min):%S(Sec)")"
echo "ELAPSED_TIME=${ELAPSED_TIME}" >> "${GITHUB_ENV}"
rm -rvf "/tmp/PKGFORGE_LOONIX.html" 2>/dev/null
echo -e "ℹ️ <b>Completed</b> <a href='https://github.com/Azathothas/Toolpacks/blob/main/.github/workflows/build_aarch64_Linux.yaml'><b>🛍️ Build 📦 Bincache (ToolPacks) 📦🗄️</b></a> <a href='https://github.com/Azathothas/Toolpacks'><b>Azathothas/Toolpacks (aarch64-Linux)</b></a> [<b><u>$(date --utc +'%Y-%m-%dT%H:%M:%S.%3N') UTC</u></b>]" > "/tmp/PKGFORGE_LOONIX.html"
echo -e "<b><u>ELAPSED_TIME</u></b>: <code>${ELAPSED_TIME}</code>" >> "/tmp/PKGFORGE_LOONIX.html"
echo -e "<b><u>Event</u></b>: <code>${GH_EVENT}</code>" >> "/tmp/PKGFORGE_LOONIX.html"
echo -e "<b><u>Log (Success)</u></b>: https://bin.pkgforge.dev/aarch64-Linux/BUILD.log.txt" >> "/tmp/PKGFORGE_LOONIX.html"
echo -e "<b><u>Log (Failure)</u></b>: https://bin.pkgforge.dev/aarch64-Linux/BUILD_FAILED.log.txt" >> "/tmp/PKGFORGE_LOONIX.html"
echo -e "<b><u>GH Repo</u></b>: https://github.com/${GITHUB_REPOSITORY}" >> "/tmp/PKGFORGE_LOONIX.html"
echo -e "<b><u>Maintainer</u></b>: @Azathothas" >> "/tmp/PKGFORGE_LOONIX.html"
curl "https://api.telegram.org/bot${PKGFORGE_LOONIX_TOKEN}/sendMessage" -d "chat_id=-1002007583969&message_thread_id=63949" -d "text=$(cat /tmp/PKGFORGE_LOONIX.html)" -d "parse_mode=html"
continue-on-error: true
#------------------------------------------------------------------------------------#
#Logs & Artifacts
- name: Upload (aarch64_Linux) Artifacts
Expand Down

0 comments on commit 0bd0a94

Please sign in to comment.