Skip to content

🛍️ Publish ⚙️ Weekly (toolpack_x86_64) Package 📦🗄️ #24

🛍️ Publish ⚙️ Weekly (toolpack_x86_64) Package 📦🗄️

🛍️ Publish ⚙️ Weekly (toolpack_x86_64) Package 📦🗄️ #24

name: 🛍️ Publish | Build ⚙️ Weekly (toolpack_x86_64) Package 📦🗄️
#MAX_RUNTIME:
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0" # 12:00 AM UTC Every Sunday (05:45 AM Morning Nepal)
env:
GITHUB_TOKEN: ${{ secrets.TOOLPACKS }}
jobs:
#------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------#
fetch-binaries:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
- name: Install CoreUtils & Deps
run: |
set +e
sudo apt-get update -y
sudo apt-get install automake b3sum build-essential ca-certificates ccache lzip jq make musl musl-dev musl-tools p7zip-full wget -y
sudo apt-get install -y --no-install-recommends autoconf automake autopoint binutils bison build-essential ca-certificates flex file jq patch patchelf pkg-config python3-pip qemu-user-static wget
#libpcap
sudo apt install 'libpcap*' -y
sudo apt install 'nmap' -y
continue-on-error: true
- name: Install PythonUtils & Deps (StaticX)
run: |
set +e
sudo apt-get install libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev xcb -y
pip install ansi2txt
pip install scons
pip install staticx
pip install pyinstaller
pip install py2static
pip install typer
continue-on-error: true
- name: Install CargoUtils & Deps
run: |
set +e
cargo install cross --git "https://github.com/cross-rs/cross"
continue-on-error: true
- name: Install Addons
run: |
set +e
#eget
curl -qfsSL "https://zyedidia.github.io/eget.sh" | bash
sudo mv ./eget* "/usr/local/bin/eget"
sudo chmod +xwr "/usr/local/bin/eget"
continue-on-error: true
- name: Install Crystal
run: |
#https://crystal-lang.org/install/on_ubuntu/
curl -fsSL https://crystal-lang.org/install.sh | sudo bash
continue-on-error: true
- name: Install Meson & Ninja
run: |
#Presets
set -x ; set +e
#Install
sudo rm "/usr/bin/meson" "/usr/bin/ninja" 2>/dev/null
pip install meson ninja --upgrade
#python3 -m pip install meson ninja --upgrade
sudo ln -s "$HOME/.local/bin/meson" "/usr/bin/meson" 2>/dev/null
sudo ln -s "$HOME/.local/bin/ninja" "/usr/bin/ninja" 2>/dev/null
sudo chmod +xwr "/usr/bin/meson" "/usr/bin/ninja"
#version
meson --version ; ninja --version
continue-on-error: true
- name: Install 7z
run: |
set -x ; set +e
cd $(mktemp -d) && curl -qfsSLJO "https://www.7-zip.org/$(curl -qfsSL "https://www.7-zip.org/download.html" | grep -o 'href="[^"]*"' | sed 's/href="//' | grep 'linux-x64.tar.xz' | sed 's/"$//' | sort | tail -n 1)"
find . -type f -name '*.xz' -exec tar -xf {} \;
#sudo rm $(which 7z) 2>/dev/null ; sudo rm $(which 7z) 2>/dev/null
sudo find . -type f -name '7zzs' ! -name '*.xz' -exec cp {} "/usr/local/bin/7z" \;
sudo chmod +xwr "/usr/local/bin/7z"
sudo find . -type f -name '7zzs' ! -name '*.xz' -exec cp {} "/usr/bin/7z" \;
sudo chmod +xwr "/usr/bin/7z"
7z -h
continue-on-error: true
- name: Install upX
run: |
cd $(mktemp -d) && curl -qfLJO "$(curl -qfsSL https://api.github.com/repos/upx/upx/releases/latest | jq -r '.assets[].browser_download_url' | grep -i 'amd64_linux')"
find . -type f -name '*tar*' -exec tar -xvf {} \;
sudo find . -type f -name 'upx' -exec mv {} "$(which upx)" \;
continue-on-error: true
- name: Setup Env
run: |
# Create Output Dir
mkdir -p "$GITHUB_WORKSPACE/main/x86_64"
- name: Download || Build Binaries
run: |
eget --rate
bash <(curl -qfsSL "https://raw.githubusercontent.com/Azathothas/Toolpacks/main/.github/scripts/eget_binaries_amd_x86_64.sh")
continue-on-error: true
- name: Strip || Cleanup
run: |
set +e
cd "$HOME/bin"
find "$HOME/bin" -maxdepth 1 -type f -exec strip {} \; 2>/dev/null
# Strip && Rename anything with *_amd*
find "$HOME/bin" -type f -name '*_Linux' -exec sh -c 'newname=$(echo "$1" | sed "s/_amd_x86_64_Linux//"); mv "$1" "$newname"' sh {} \;
continue-on-error: true
- name: Pack Binaries
run: |
#Copy to Repo
#Exclude copying bins > 100 MB
find "$HOME/bin" -maxdepth 1 -type f ! -size +99M -exec cp {} "$GITHUB_WORKSPACE/main/x86_64" \;
#Copy to /tmp/toolpack_x86_64
mkdir -p /tmp/toolpack_x86_64
find "$HOME/bin" -maxdepth 1 -type f -exec cp {} "/tmp/toolpack_x86_64" \;
continue-on-error: true
- name: Archive Binaries (.tar) # This is a requirement for others
run: |
cd /tmp ; set +e ; set -x
# Compress to tar (size ~ orignal_size, maybe slight increase)
tar -cvf /tmp/toolpack_x86_64.tar -C /tmp toolpack_x86_64
#7z a -r -ttar -mx="9" -mmt="$(($(nproc)+1))" /tmp/toolpack_x86_64.tar /tmp/toolpack_x86_64 2>/dev/null
sha256sum /tmp/toolpack_x86_64.tar
continue-on-error: true
- name: Upload_toolpack_x86_64_Artifacts
uses: actions/upload-artifact@v3
with:
name: toolpack_x86_64.tar
path: |
/tmp/toolpack_x86_64.tar
- name: Update README.md
run: |
set -x ; set +e
cd "$GITHUB_WORKSPACE/main"
cat ./x86_64/INFO.md > ./x86_64/README.md
echo -e "" >> ./x86_64/README.md
echo '---' >> ./x86_64/README.md
echo '```console' >> ./x86_64/README.md
echo -e "" >> ./x86_64/README.md
echo -e "--> METATDATA" >> ./x86_64/README.md
/bin/bash -c 'PS4="$ "; file ./x86_64/* | grep -v '.txt' ' &>> ./x86_64/README.md
echo -e "" >> ./x86_64/README.md
echo -e "--> SHA256SUM" >> ./x86_64/README.md
/bin/bash -c 'PS4="$ ";sha256sum ./x86_64/* | grep -v '.txt' ' &>> ./x86_64/README.md
echo -e '```\n' >> ./x86_64/README.md
echo -e "" >> ./x86_64/README.md
echo '---' >> ./x86_64/README.md
echo -e "" >> ./x86_64/README.md
echo '- #### Sizes' >> ./x86_64/README.md
echo -e "" >> ./x86_64/README.md
echo '```console' >> ./x86_64/README.md
/bin/bash -c 'PS4="$ ";ls -lh ./x86_64/* | grep -v '.txt' | awk "{print \$5, \$9}" | column -t' &>> ./x86_64/README.md
echo -e "\n[+] Total Size: $(du -h ./x86_64 | awk '{print $1}')\n"
echo '```' >> ./x86_64/README.md
echo -e "" >> ./x86_64/README.md
echo '---' >> ./x86_64/README.md
echo -e "" >> ./x86_64/README.md
continue-on-error: true
- name: Git Pull
run: |
cd "$GITHUB_WORKSPACE/main" && git pull origin main
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
- uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: ./main
commit_user_name: Azathothas # defaults to "github-actions[bot]"
commit_user_email: [email protected] # defaults to "41898282+github-actions[bot]@users.noreply.github.com"
commit_message: "✅ 🛍️ Publish Weekly (toolpack_x86_64) Package 📦🗄️ <-- ${{ env.NEPALI_TIME }} ⌚"
#push_options: '--force'
#------------------------------------------------------------------------------------#
archive-binaries-7z:
needs: [fetch-binaries]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
- name: Install CoreUtils & Deps
run: |
sudo apt-get update -y
sudo apt-get install automake b3sum build-essential ca-certificates ccache lzip jq make musl musl-dev musl-tools p7zip-full wget -y
pip install ansi2txt
#eget
curl -qfsSL "https://zyedidia.github.io/eget.sh" | bash
sudo mv ./eget* "/usr/local/bin/eget"
sudo chmod +xwr "/usr/local/bin/eget"
continue-on-error: true
- name: Install 7z
run: |
set -x ; set +e
cd $(mktemp -d) && curl -qfsSLJO "https://www.7-zip.org/$(curl -qfsSL "https://www.7-zip.org/download.html" | grep -o 'href="[^"]*"' | sed 's/href="//' | grep 'linux-x64.tar.xz' | sed 's/"$//' | sort | tail -n 1)"
find . -type f -name '*.xz' -exec tar -xf {} \;
#sudo rm $(which 7z) 2>/dev/null ; sudo rm $(which 7z) 2>/dev/null
sudo find . -type f -name '7zzs' ! -name '*.xz' -exec cp {} "/usr/local/bin/7z" \;
sudo chmod +xwr "/usr/local/bin/7z"
sudo find . -type f -name '7zzs' ! -name '*.xz' -exec cp {} "/usr/bin/7z" \;
sudo chmod +xwr "/usr/bin/7z"
7z -h
continue-on-error: true
- name: Download_toolpack_x86_64_Artifacts
uses: actions/download-artifact@v3
with:
name: toolpack_x86_64.tar
path: /tmp/
- name: Archive Binaries (.7z)
run: |
cd /tmp ; set +e
sha256sum /tmp/toolpack_x86_64.tar
# untar the tar
tar -xvf /tmp/toolpack_x86_64.tar
# .7z
7z a -r -t7z -mx="9" -mmt="$(($(nproc)+1))" /tmp/toolpack_x86_64.7z /tmp/toolpack_x86_64 2>/dev/null
sha256sum /tmp/toolpack_x86_64.7z
continue-on-error: true
- name: Upload_toolpack_x86_64.7z
uses: actions/upload-artifact@v3
with:
name: toolpack_x86_64.7z
path: |
/tmp/toolpack_x86_64.7z
#------------------------------------------------------------------------------------#
archive-binaries-bz2:
needs: [fetch-binaries]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
- name: Install CoreUtils & Deps
run: |
sudo apt-get update -y
sudo apt-get install automake b3sum build-essential ca-certificates ccache lzip jq make musl musl-dev musl-tools p7zip-full wget -y
pip install ansi2txt
#eget
curl -qfsSL "https://zyedidia.github.io/eget.sh" | bash
sudo mv ./eget* "/usr/local/bin/eget"
sudo chmod +xwr "/usr/local/bin/eget"
continue-on-error: true
- name: Install 7z
run: |
set -x ; set +e
cd $(mktemp -d) && curl -qfsSLJO "https://www.7-zip.org/$(curl -qfsSL "https://www.7-zip.org/download.html" | grep -o 'href="[^"]*"' | sed 's/href="//' | grep 'linux-x64.tar.xz' | sed 's/"$//' | sort | tail -n 1)"
find . -type f -name '*.xz' -exec tar -xf {} \;
#sudo rm $(which 7z) 2>/dev/null ; sudo rm $(which 7z) 2>/dev/null
sudo find . -type f -name '7zzs' ! -name '*.xz' -exec cp {} "/usr/local/bin/7z" \;
sudo chmod +xwr "/usr/local/bin/7z"
sudo find . -type f -name '7zzs' ! -name '*.xz' -exec cp {} "/usr/bin/7z" \;
sudo chmod +xwr "/usr/bin/7z"
7z -h
continue-on-error: true
- name: Download_toolpack_x86_64_Artifacts
uses: actions/download-artifact@v3
with:
name: toolpack_x86_64.tar
path: /tmp/
- name: Archive Binaries (.bzip2)
run: |
cd /tmp ; set +e
sha256sum /tmp/toolpack_x86_64.tar
# Compress tar to bzip2
7z a -r -tbzip2 -mx="9" -mmt="$(($(nproc)+1))" /tmp/toolpack_x86_64.tar.bz2 /tmp/toolpack_x86_64.tar 2>/dev/null
sha256sum /tmp/toolpack_x86_64.tar.bz2
continue-on-error: true
- name: Upload_toolpack_x86_64.tar.bz2
uses: actions/upload-artifact@v3
with:
name: toolpack_x86_64.tar.bz2
path: |
/tmp/toolpack_x86_64.tar.bz2
#------------------------------------------------------------------------------------#
archive-binaries-gz:
needs: [fetch-binaries]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
- name: Install CoreUtils & Deps
run: |
sudo apt-get update -y
sudo apt-get install automake b3sum build-essential ca-certificates ccache lzip jq make musl musl-dev musl-tools p7zip-full wget -y
pip install ansi2txt
#eget
curl -qfsSL "https://zyedidia.github.io/eget.sh" | bash
sudo mv ./eget* "/usr/local/bin/eget"
sudo chmod +xwr "/usr/local/bin/eget"
continue-on-error: true
- name: Install 7z
run: |
set -x ; set +e
cd $(mktemp -d) && curl -qfsSLJO "https://www.7-zip.org/$(curl -qfsSL "https://www.7-zip.org/download.html" | grep -o 'href="[^"]*"' | sed 's/href="//' | grep 'linux-x64.tar.xz' | sed 's/"$//' | sort | tail -n 1)"
find . -type f -name '*.xz' -exec tar -xf {} \;
#sudo rm $(which 7z) 2>/dev/null ; sudo rm $(which 7z) 2>/dev/null
sudo find . -type f -name '7zzs' ! -name '*.xz' -exec cp {} "/usr/local/bin/7z" \;
sudo chmod +xwr "/usr/local/bin/7z"
sudo find . -type f -name '7zzs' ! -name '*.xz' -exec cp {} "/usr/bin/7z" \;
sudo chmod +xwr "/usr/bin/7z"
7z -h
continue-on-error: true
- name: Download_toolpack_x86_64_Artifacts
uses: actions/download-artifact@v3
with:
name: toolpack_x86_64.tar
path: /tmp/
- name: Archive Binaries (.gz)
run: |
cd /tmp ; set +e
sha256sum /tmp/toolpack_x86_64.tar
# Compress tar to .gz
7z a -r -tgzip -mx="9" -mmt="$(($(nproc)+1))" /tmp/toolpack_x86_64.gz /tmp/toolpack_x86_64.tar 2>/dev/null
# tar.gz --> if compressed archive has files + folders
# .tgz --> short for tar.gz
sha256sum /tmp/toolpack_x86_64.gz
continue-on-error: true
- name: Upload_toolpack_x86_64.gz
uses: actions/upload-artifact@v3
with:
name: toolpack_x86_64.gz
path: |
/tmp/toolpack_x86_64.gz
#------------------------------------------------------------------------------------#
archive-binaries-zip:
needs: [fetch-binaries]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
- name: Install CoreUtils & Deps
run: |
sudo apt-get update -y
sudo apt-get install automake b3sum build-essential ca-certificates ccache lzip jq make musl musl-dev musl-tools p7zip-full wget -y
pip install ansi2txt
#eget
curl -qfsSL "https://zyedidia.github.io/eget.sh" | bash
sudo mv ./eget* "/usr/local/bin/eget"
sudo chmod +xwr "/usr/local/bin/eget"
continue-on-error: true
- name: Install 7z
run: |
set -x ; set +e
cd $(mktemp -d) && curl -qfsSLJO "https://www.7-zip.org/$(curl -qfsSL "https://www.7-zip.org/download.html" | grep -o 'href="[^"]*"' | sed 's/href="//' | grep 'linux-x64.tar.xz' | sed 's/"$//' | sort | tail -n 1)"
find . -type f -name '*.xz' -exec tar -xf {} \;
#sudo rm $(which 7z) 2>/dev/null ; sudo rm $(which 7z) 2>/dev/null
sudo find . -type f -name '7zzs' ! -name '*.xz' -exec cp {} "/usr/local/bin/7z" \;
sudo chmod +xwr "/usr/local/bin/7z"
sudo find . -type f -name '7zzs' ! -name '*.xz' -exec cp {} "/usr/bin/7z" \;
sudo chmod +xwr "/usr/bin/7z"
7z -h
continue-on-error: true
- name: Download_toolpack_x86_64_Artifacts
uses: actions/download-artifact@v3
with:
name: toolpack_x86_64.tar
path: /tmp/
- name: Archive Binaries (.zip)
run: |
cd /tmp ; set +e
sha256sum /tmp/toolpack_x86_64.tar
# untar the tar
tar -xvf /tmp/toolpack_x86_64.tar
# .zip
7z a -r -tzip -mx="9" -mmt="$(($(nproc)+1))" /tmp/toolpack_x86_64.zip /tmp/toolpack_x86_64 2>/dev/null
sha256sum /tmp/toolpack_x86_64.zip
continue-on-error: true
- name: Upload_toolpack_x86_64.zip
uses: actions/upload-artifact@v3
with:
name: toolpack_x86_64.zip
path: |
/tmp/toolpack_x86_64.zip
#------------------------------------------------------------------------------------#
create-release:
needs: [fetch-binaries, archive-binaries-7z, archive-binaries-bz2, archive-binaries-gz, archive-binaries-zip]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
- name: Download_All_Artifacts
uses: actions/download-artifact@v3
with:
path: /tmp/
- name: Make Skeleton for Release
run: |
mkdir -p /tmp/releases/ ; cd /tmp ; set +e
# Move
find /tmp -type f -name '*.7z' 2>/dev/null -exec mv {} /tmp/releases \;
find /tmp -type f -name '*.gz' 2>/dev/null -exec mv {} /tmp/releases \;
find /tmp -type f -name '*.tar' ! -name '*.bz2' 2>/dev/null -exec mv {} /tmp/releases \;
find /tmp -type f -name '*.tar.bz2' 2>/dev/null -exec mv {} /tmp/releases \;
find /tmp -type f -name '*.zip' 2>/dev/null -exec mv {} /tmp/releases \;
find /tmp -type d -empty -delete 2>/dev/null
find /tmp -size 0 -delete 2>/dev/null
continue-on-error: true
- name: Untar the tar
run: |
cd /tmp ; set +e
# list
ls /tmp/releases
file /tmp/releases/*
# untar the tar
tar -xvf /tmp/releases/toolpack_x86_64.tar
continue-on-error: true
- name: Create Body for Release
run: |
set +e
cd /tmp/toolpack_x86_64/
echo -e "" >> /tmp/RELEASE_NOTE.md
echo '---' >> /tmp/RELEASE_NOTE.md
echo '```console' >> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo "Details: 'https://github.com/Azathothas/Toolpacks/tree/main/x86_64'" >> /tmp/RELEASE_NOTE.md
echo "Download: 'https://github.com/Azathothas/Toolpacks/tree/main/x86_64#download-toolpack'" >> /tmp/RELEASE_NOTE.md
echo "Install: 'https://github.com/Azathothas/Toolpacks/tree/main/x86_64#install-toolpack'" >> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo -e "--> METADATA" >> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ "; file * | grep -v '.txt' '&>> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo -e "--> SHA256SUM" >> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ ";sha256sum * | grep -v '.txt' ' &>> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ ";sha256sum /tmp/releases/toolpack_x86_64.7z ' &>> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ ";sha256sum /tmp/releases/toolpack_x86_64.gz ' &>> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ ";sha256sum /tmp/releases/toolpack_x86_64.tar ' &>> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ ";sha256sum /tmp/releases/toolpack_x86_64.tar.bz2 ' &>> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ ";sha256sum /tmp/releases/toolpack_x86_64.zip ' &>> /tmp/RELEASE_NOTE.md
echo -e '```\n' >> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo '---' >> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo '- #### Sizes' >> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo '```console' >> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ "; ls -lh ./* | grep -v '.txt' | awk "{print \$5, \$9}" | column -t' &>> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ "; ls -lh /tmp/releases/toolpack_x86_64.7z | awk "{print \$5, \$9}" | column -t' &>> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ "; ls -lh /tmp/releases/toolpack_x86_64.gz | awk "{print \$5, \$9}" | column -t' &>> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ "; ls -lh /tmp/releases/toolpack_x86_64.tar.bz2 | awk "{print \$5, \$9}" | column -t' &>> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ "; ls -lh /tmp/releases/toolpack_x86_64.zip | awk "{print \$5, \$9}" | column -t' &>> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo '```' >> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
continue-on-error: true
- name: Get Safe_DateTime
run: |
# Date Time
SAFE_NEPALI_TIME=$(TZ='Asia/Kathmandu' date +'%Y-%m-%d_%I:%M:%S_%p' | tr ' :-' '_')
echo "SAFE_NEPALI_TIME=$SAFE_NEPALI_TIME" >> $GITHUB_ENV
continue-on-error: true
- name: Releaser
uses: softprops/[email protected]
with:
name: "Toolpack (x86_64) Weekly ${{ env.SAFE_NEPALI_TIME }}"
tag_name: "toolpack_x86_64_${{ env.SAFE_NEPALI_TIME }}"
prerelease: false
draft: false
generate_release_notes: false
token: "${{ secrets.GITHUB_TOKEN }}"
body_path: "/tmp/RELEASE_NOTE.md"
files: |
/tmp/releases/*z*
continue-on-error: true
#------------------------------------------------------------------------------------#