This repository has been archived by the owner on Jul 8, 2024. It is now read-only.
⚙️ Build misc-utils 📦 #58
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: ⚙️ Build misc-utils 📦 | |
#MAX_RUNTIME: | |
on: | |
workflow_dispatch: | |
schedule: | |
#- cron: "0 0 * * 0" # 12:00 AM UTC Every Sunday (05:45 AM Morning Nepal) | |
- cron: "0 0 */3 * *" #Every 3 days | |
env: | |
GITHUB_TOKEN: ${{ secrets.STATIC_TOOLBOX }} | |
jobs: | |
#------------------------------------------------------------------------------------# | |
#------------------------------------------------------------------------------------# | |
build-misc-utils: | |
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 xsltproc | |
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 7z | |
run: | | |
#Presets | |
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: | | |
#Presets | |
set -x ; set +e | |
#--------------# | |
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: | | |
#Presets | |
set -x ; set +e | |
#--------------# | |
# Create Output Dir | |
mkdir -p "/tmp/releases" | |
continue-on-error: true | |
#------------------------------------------------------------------------------------# | |
#gawk | |
- name: Build (awk | gawk) for amd_x86_64 (Natively) | |
run: | | |
#Presets | |
set -x ; set +e | |
#--------------# | |
#Get Script | |
pushd "$(mktemp -d)" ; git clone "https://github.com/Azathothas/gawk-static" && cd "./gawk-static" | |
#Build | |
sudo bash "./build.sh" | |
#Cleanup | |
find . -type f -name "*.tar*" -exec tar -xvf {} \; | |
cp "./release/gawk" "/tmp/releases/awk_amd_x86_64" | |
mv "./release/gawk" "/tmp/releases/gawk_amd_x86_64" | |
#meta | |
file /tmp/releases/* && ls /tmp/releases/* -lahr | |
continue-on-error: true | |
- name: Build gawk for aarch64_arm64_arm64-v8 (Docker) | |
run: | | |
#Presets | |
set -x ; set +e | |
#--------------# | |
docker run --privileged --name "arm64v8_debian" \ | |
"arm64v8/debian:latest" \ | |
bash -c ' | |
export DEBIAN_FRONTEND=noninteractive | |
apt-get update -y ; apt-get dist-upgrade -y ; apt-get upgrade -y | |
apt install -y autoconf automake autopoint curl devscripts dpkg-dev file g++ gawk make libtool jq pkgconf tcl patch pkg-config wget tar unzip xsltproc | |
apt install autoconf automake autopoint binutils bison build-essential ca-certificates coreutils curl dos2unix git gcc htop flex file jq moreutils nano pkg-config sudo util-linux wget -y | |
apt install "*glibc*" "libssl*" lzip musl musl-dev musl-tools "openssl*" -y | |
apt install asciidoctor libcapnp-dev libcap-ng-dev libcap-ng-utils libpython3-dev po4a zlib1g-dev -y | |
pushd "$(mktemp -d)" && curl -qfLJO "$(curl -qfsSL https://api.github.com/repos/upx/upx/releases/latest | jq -r ".assets[].browser_download_url" | grep -i "arm64_linux")" | |
find . -type f -name "*tar*" -exec tar -xvf {} \; | |
sudo find . -type f -name "upx" -exec mv {} "/usr/bin/upx" \; | |
sudo cp "/usr/bin/upx" "/usr/local/bin/upx" | |
sudo chmod +xwr "/usr/bin/upx" "/usr/local/bin/upx" ; upx -h ; popd | |
git clone "https://github.com/Azathothas/gawk-static" && cd "./gawk-static" | |
sudo bash "./build.sh" | |
find . -type f -name "*.tar*" -exec tar -xvf {} \; | |
cp "./release/gawk" "/awk_aarch64_arm64" | |
mv "./release/gawk" "/gawk_aarch64_arm64" | |
' | |
#Copy | |
docker cp "arm64v8_debian:./awk_aarch64_arm64" "/tmp/releases/awk_aarch64_arm64" | |
docker cp "arm64v8_debian:./gawk_aarch64_arm64" "/tmp/releases/gawk_aarch64_arm64" | |
#meta | |
file /tmp/releases/* && ls /tmp/releases/* -lahr | |
#Delete Containers | |
docker ps -a -q | xargs docker rm >/dev/null 2>&1 | |
#Del Docker Images | |
docker images -q | xargs docker rmi -f >/dev/null 2>&1 | |
continue-on-error: true | |
#------------------------------------------------------------------------------------# | |
#grep | |
- name: Build grep for amd_x86_64 (Natively) | |
run: | | |
#Presets | |
set -x ; set +e | |
#--------------# | |
#Get Script | |
pushd "$(mktemp -d)" ; git clone "https://github.com/Azathothas/grep-static" && cd "./grep-static" | |
#Build | |
sudo bash "./build.sh" | |
#Cleanup | |
find . -type f -name "*.tar*" -exec tar -xvf {} \; | |
mv "./release/grep" "/tmp/releases/grep_amd_x86_64" | |
#meta | |
file /tmp/releases/* && ls /tmp/releases/* -lahr | |
continue-on-error: true | |
- name: Build grep for aarch64_arm64_arm64-v8 (Docker) | |
run: | | |
#Presets | |
set -x ; set +e | |
#--------------# | |
docker run --privileged --name "arm64v8_debian" \ | |
"arm64v8/debian:latest" \ | |
bash -c ' | |
export DEBIAN_FRONTEND=noninteractive | |
apt-get update -y ; apt-get dist-upgrade -y ; apt-get upgrade -y | |
apt install -y autoconf automake autopoint curl devscripts dpkg-dev file g++ gawk make libtool jq pkgconf tcl patch pkg-config wget tar unzip xsltproc | |
apt install autoconf automake autopoint binutils bison build-essential ca-certificates coreutils curl dos2unix git gcc htop flex file jq moreutils nano pkg-config sudo util-linux wget -y | |
apt install "*glibc*" "libssl*" lzip musl musl-dev musl-tools "openssl*" -y | |
apt install asciidoctor libcapnp-dev libcap-ng-dev libcap-ng-utils libpython3-dev po4a zlib1g-dev -y | |
pushd "$(mktemp -d)" && curl -qfLJO "$(curl -qfsSL https://api.github.com/repos/upx/upx/releases/latest | jq -r ".assets[].browser_download_url" | grep -i "arm64_linux")" | |
find . -type f -name "*tar*" -exec tar -xvf {} \; | |
sudo find . -type f -name "upx" -exec mv {} "/usr/bin/upx" \; | |
sudo cp "/usr/bin/upx" "/usr/local/bin/upx" | |
sudo chmod +xwr "/usr/bin/upx" "/usr/local/bin/upx" ; upx -h ; popd | |
git clone "https://github.com/Azathothas/grep-static" && cd "./grep-static" | |
sudo bash "./build.sh" | |
find . -type f -name "*.tar*" -exec tar -xvf {} \; | |
mv "./release/grep" "/grep_aarch64_arm64" | |
' | |
#Copy | |
docker cp "arm64v8_debian:./grep_aarch64_arm64" "/tmp/releases/grep_aarch64_arm64" | |
#meta | |
file /tmp/releases/* && ls /tmp/releases/* -lahr | |
#Delete Containers | |
docker ps -a -q | xargs docker rm >/dev/null 2>&1 | |
#Del Docker Images | |
docker images -q | xargs docker rmi -f >/dev/null 2>&1 | |
continue-on-error: true | |
#------------------------------------------------------------------------------------# | |
#sed | |
- name: Build sed for amd_x86_64 (Natively) | |
run: | | |
#Presets | |
set -x ; set +e | |
#--------------# | |
#Get Script | |
pushd "$(mktemp -d)" ; git clone "https://github.com/Azathothas/sed-static" && cd "./sed-static" | |
#Build | |
sudo bash "./build.sh" | |
#Cleanup | |
find . -type f -name "*.tar*" -exec tar -xvf {} \; | |
mv "./release/sed" "/tmp/releases/sed_amd_x86_64" | |
#meta | |
file /tmp/releases/* && ls /tmp/releases/* -lahr | |
continue-on-error: true | |
- name: Build sed for aarch64_arm64_arm64-v8 (Docker) | |
run: | | |
#Presets | |
set -x ; set +e | |
#--------------# | |
docker run --privileged --name "arm64v8_debian" \ | |
"arm64v8/debian:latest" \ | |
bash -c ' | |
export DEBIAN_FRONTEND=noninteractive | |
apt-get update -y ; apt-get dist-upgrade -y ; apt-get upgrade -y | |
apt install -y autoconf automake autopoint curl devscripts dpkg-dev file g++ gawk make libtool jq pkgconf tcl patch pkg-config wget tar unzip xsltproc | |
apt install autoconf automake autopoint binutils bison build-essential ca-certificates coreutils curl dos2unix git gcc htop flex file jq moreutils nano pkg-config sudo util-linux wget -y | |
apt install "*glibc*" "libssl*" lzip musl musl-dev musl-tools "openssl*" -y | |
apt install asciidoctor libcapnp-dev libcap-ng-dev libcap-ng-utils libpython3-dev po4a zlib1g-dev -y | |
pushd "$(mktemp -d)" && curl -qfLJO "$(curl -qfsSL https://api.github.com/repos/upx/upx/releases/latest | jq -r ".assets[].browser_download_url" | grep -i "arm64_linux")" | |
find . -type f -name "*tar*" -exec tar -xvf {} \; | |
sudo find . -type f -name "upx" -exec mv {} "/usr/bin/upx" \; | |
sudo cp "/usr/bin/upx" "/usr/local/bin/upx" | |
sudo chmod +xwr "/usr/bin/upx" "/usr/local/bin/upx" ; upx -h ; popd | |
git clone "https://github.com/Azathothas/sed-static" && cd "./sed-static" | |
sudo bash "./build.sh" | |
find . -type f -name "*.tar*" -exec tar -xvf {} \; | |
mv "./release/sed" "/sed_aarch64_arm64" | |
' | |
#Copy | |
docker cp "arm64v8_debian:./sed_aarch64_arm64" "/tmp/releases/sed_aarch64_arm64" | |
#meta | |
file /tmp/releases/* && ls /tmp/releases/* -lahr | |
#Delete Containers | |
docker ps -a -q | xargs docker rm >/dev/null 2>&1 | |
#Del Docker Images | |
docker images -q | xargs docker rmi -f >/dev/null 2>&1 | |
continue-on-error: true | |
#------------------------------------------------------------------------------------# | |
#tar | |
- name: Build tar for amd_x86_64 (Natively) | |
run: | | |
#Presets | |
set -x ; set +e | |
#--------------# | |
#Get Script | |
pushd "$(mktemp -d)" ; git clone "https://github.com/Azathothas/tar-static" && cd "./tar-static" | |
#Build | |
sudo bash "./build.sh" | |
#Cleanup | |
find . -type f -name "*.tar*" -exec tar -xvf {} \; | |
mv "./release/tar" "/tmp/releases/tar_amd_x86_64" | |
#meta | |
file /tmp/releases/* && ls /tmp/releases/* -lahr | |
continue-on-error: true | |
- name: Build tar for aarch64_arm64_arm64-v8 (Docker) | |
run: | | |
#Presets | |
set -x ; set +e | |
#--------------# | |
docker run --privileged --name "arm64v8_debian" \ | |
"arm64v8/debian:latest" \ | |
bash -c ' | |
export DEBIAN_FRONTEND=noninteractive | |
apt-get update -y ; apt-get dist-upgrade -y ; apt-get upgrade -y | |
apt install -y autoconf automake autopoint curl devscripts dpkg-dev file g++ gawk make libtool jq pkgconf tcl patch pkg-config wget tar unzip xsltproc | |
apt install autoconf automake autopoint binutils bison build-essential ca-certificates coreutils curl dos2unix git gcc htop flex file jq moreutils nano pkg-config sudo util-linux wget -y | |
apt install "*glibc*" "libssl*" lzip musl musl-dev musl-tools "openssl*" -y | |
apt install asciidoctor libcapnp-dev libcap-ng-dev libcap-ng-utils libpython3-dev po4a zlib1g-dev -y | |
pushd "$(mktemp -d)" && curl -qfLJO "$(curl -qfsSL https://api.github.com/repos/upx/upx/releases/latest | jq -r ".assets[].browser_download_url" | grep -i "arm64_linux")" | |
find . -type f -name "*tar*" -exec tar -xvf {} \; | |
sudo find . -type f -name "upx" -exec mv {} "/usr/bin/upx" \; | |
sudo cp "/usr/bin/upx" "/usr/local/bin/upx" | |
sudo chmod +xwr "/usr/bin/upx" "/usr/local/bin/upx" ; upx -h ; popd | |
git clone "https://github.com/Azathothas/tar-static" && cd "./tar-static" | |
sudo bash "./build.sh" | |
find . -type f -name "*.tar*" -exec tar -xvf {} \; | |
mv "./release/tar" "/tar_aarch64_arm64" | |
' | |
#Copy | |
docker cp "arm64v8_debian:./tar_aarch64_arm64" "/tmp/releases/tar_aarch64_arm64" | |
#meta | |
file /tmp/releases/* && ls /tmp/releases/* -lahr | |
#Delete Containers | |
docker ps -a -q | xargs docker rm >/dev/null 2>&1 | |
#Del Docker Images | |
docker images -q | xargs docker rmi -f >/dev/null 2>&1 | |
continue-on-error: true | |
#------------------------------------------------------------------------------------# | |
#which | |
- name: Build which for amd_x86_64 (Natively) | |
run: | | |
#Presets | |
set -x ; set +e | |
#--------------# | |
#Get Script | |
pushd "$(mktemp -d)" ; git clone "https://github.com/Azathothas/which-static" && cd "./which-static" | |
#Build | |
sudo bash "./build.sh" | |
#Cleanup | |
find . -type f -name "*.tar*" -exec tar -xvf {} \; | |
mv "./release/which" "/tmp/releases/which_amd_x86_64" | |
#meta | |
file /tmp/releases/* && ls /tmp/releases/* -lahr | |
continue-on-error: true | |
- name: Build which for aarch64_arm64_arm64-v8 (Docker) | |
run: | | |
#Presets | |
set -x ; set +e | |
#--------------# | |
docker run --privileged --name "arm64v8_debian" \ | |
"arm64v8/debian:latest" \ | |
bash -c ' | |
export DEBIAN_FRONTEND=noninteractive | |
apt-get update -y ; apt-get dist-upgrade -y ; apt-get upgrade -y | |
apt install -y autoconf automake autopoint curl devscripts dpkg-dev file g++ gawk make libtool jq pkgconf tcl patch pkg-config wget tar unzip xsltproc | |
apt install autoconf automake autopoint binutils bison build-essential ca-certificates coreutils curl dos2unix git gcc htop flex file jq moreutils nano pkg-config sudo util-linux wget -y | |
apt install "*glibc*" "libssl*" lzip musl musl-dev musl-tools "openssl*" -y | |
apt install asciidoctor libcapnp-dev libcap-ng-dev libcap-ng-utils libpython3-dev po4a zlib1g-dev -y | |
pushd "$(mktemp -d)" && curl -qfLJO "$(curl -qfsSL https://api.github.com/repos/upx/upx/releases/latest | jq -r ".assets[].browser_download_url" | grep -i "arm64_linux")" | |
find . -type f -name "*tar*" -exec tar -xvf {} \; | |
sudo find . -type f -name "upx" -exec mv {} "/usr/bin/upx" \; | |
sudo cp "/usr/bin/upx" "/usr/local/bin/upx" | |
sudo chmod +xwr "/usr/bin/upx" "/usr/local/bin/upx" ; upx -h ; popd | |
git clone "https://github.com/Azathothas/which-static" && cd "./which-static" | |
sudo bash "./build.sh" | |
find . -type f -name "*.tar*" -exec tar -xvf {} \; | |
mv "./release/which" "/which_aarch64_arm64" | |
' | |
#Copy | |
docker cp "arm64v8_debian:./which_aarch64_arm64" "/tmp/releases/which_aarch64_arm64" | |
#meta | |
file /tmp/releases/* && ls /tmp/releases/* -lahr | |
#Delete Containers | |
docker ps -a -q | xargs docker rm >/dev/null 2>&1 | |
#Del Docker Images | |
docker images -q | xargs docker rmi -f >/dev/null 2>&1 | |
continue-on-error: true | |
#------------------------------------------------------------------------------------# | |
- name: Create Body for Release | |
run: | | |
set +e | |
cd /tmp/releases | |
echo -e "" >> /tmp/RELEASE_NOTE.md | |
echo '---' >> /tmp/RELEASE_NOTE.md | |
echo '```console' >> /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 | |
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 | |
echo -e "" >> /tmp/RELEASE_NOTE.md | |
echo '```' >> /tmp/RELEASE_NOTE.md | |
echo -e "" >> /tmp/RELEASE_NOTE.md | |
continue-on-error: true | |
- name: Cat Release Body | |
run: | | |
set +e | |
cat "/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/action-gh-release@v0.1.15 | |
with: | |
name: "misc-utils Weekly ${{ env.SAFE_NEPALI_TIME }}" | |
tag_name: "misc_utils_${{ 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/* | |
#-------------------------------------------------------------# |