Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

🛍️ Publish ⚙️ Weekly 📦DistroPacks🗄️ #60

🛍️ Publish ⚙️ Weekly 📦DistroPacks🗄️

🛍️ Publish ⚙️ Weekly 📦DistroPacks🗄️ #60

name: 🛍️ Publish ⚙️ Weekly 📦DistroPacks🗄️
#MAX_RUNTIME:
on:
workflow_dispatch:
schedule:
#- cron: "0 0 * * 0" # 12:00 AM UTC Every Sunday (05:45 AM Morning Nepal)
- cron: "0 0 */6 * *" #Every 6 days
env:
GITHUB_TOKEN: ${{ secrets.DISTROPACKS }}
jobs:
#------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------#
fetch-distros:
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
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
touch "$GITHUB_WORKSPACE/main/INFO.md"
continue-on-error: true
- name: Download (salsa.debian.org) Distros
run: |
#Presets
set -x ; set +e
#--------------#
#tmp-dir
mkdir -p "/tmp/releases" ; cd "/tmp/releases"
##Debian-12-Bookworm (arm64)
wget "https://salsa.debian.org/debian/WSL/-/raw/master/ARM64/install.tar.gz" -O "/tmp/releases/debian_12_bookworm_aarch64_arm64_WSL.tar.gz"
#to tar
7z x "/tmp/releases/debian_12_bookworm_aarch64_arm64_WSL.tar.gz"
##Debian-12-Bookworm (x64)
wget "https://salsa.debian.org/debian/WSL/-/raw/master/x64/install.tar.gz" -O "/tmp/releases/debian_12_bookworm_amd_x64_WSL.tar.gz"
#to tar
7z x "/tmp/releases/debian_12_bookworm_amd_x64_WSL.tar.gz"
continue-on-error: true
- name: Extract From Docker
run: |
#Presets
set -x ; set +e
#--------------#
#tmp-dir
mkdir -p "/tmp/releases" ; cd "/tmp/releases"
#FailSafe
docker ps --filter status=exited -q | xargs docker rm 2>/dev/null
#Run
bash <(curl -qfsSL "https://raw.githubusercontent.com/Azathothas/Distropacks/main/.github/scripts/distropack_docker_extract_distros.sh") | tee "/tmp/distropack_docker.md"
#Releases: "/tmp/docker-tars"
#Move to "/tmp/releases"
find "/tmp/docker-tars" -type f -name "*.tar" -exec mv {} "/tmp/releases" \;
continue-on-error: true
#GH shuts this down
# - name: 7z Everything
# run: |
# #Presets
# set -x ; set +e
# #--------------#
# #Env
# TOTAL_SIZE="$(du -h /tmp/releases | awk '{print $1}')" && export TOTAL_SIZE="$TOTAL_SIZE"
# echo "TOTAL_SIZE=$TOTAL_SIZE" >> $GITHUB_ENV
# echo "Total Pack Size: $TOTAL_SIZE"
# SAFE_NEPALI_TIME=$(TZ='Asia/Kathmandu' date +'%Y-%m-%d_%I:%M:%S_%p' | tr ' :-' '_')
# echo "SAFE_NEPALI_TIME=$SAFE_NEPALI_TIME" >> $GITHUB_ENV
# #7z (Compresses ~ 10 GB --> 10 Mins)
# 7z a -r -t7z -mx="9" -mmt="$(($(nproc)+1))" "/tmp/Complete_Distropack_weekly_${{ env.SAFE_NEPALI_TIME }}.7z" "/tmp/releases"
# #7z a -r -t7z -mx="9" -mmt="$(($(nproc)+1))" "/tmp/Complete_Distropack_weekly_$SAFE_NEPALI_TIME.7z" "/tmp/releases"
# #Move
# mv "/tmp/Complete_Distropack_weekly_${{ env.SAFE_NEPALI_TIME }}.7z" "/tmp/releases"
# continue-on-error: true
- name: Update Readme.md
run: |
#Presets
set -x ; set +e
#--------------#
cd "$GITHUB_WORKSPACE/main"
#Metadata
cat "$GITHUB_WORKSPACE/main/INFO.md" > "$GITHUB_WORKSPACE/main/README.md"
echo -e "" >> "$GITHUB_WORKSPACE/main/README.md"
echo '---' >> "$GITHUB_WORKSPACE/main/README.md"
echo -e "" >> "$GITHUB_WORKSPACE/main/README.md"
echo "- #### Metadata" >>"$GITHUB_WORKSPACE/main/README.md"
echo '```mathematica' >> "$GITHUB_WORKSPACE/main/README.md"
echo "$(cat /tmp/distropack_docker.md)" >> "$GITHUB_WORKSPACE/main/README.md"
echo -e "" >> "$GITHUB_WORKSPACE/main/README.md"
echo '```' >> "$GITHUB_WORKSPACE/main/README.md"
echo -e "" >> "$GITHUB_WORKSPACE/main/README.md"
echo '---' >> "$GITHUB_WORKSPACE/main/README.md"
echo -e "" >> "$GITHUB_WORKSPACE/main/README.md"
- name: Create Body for Release
run: |
#Presets
set -x ; set +e
#--------------#
#chdir
cd "/tmp/releases/"
#Metadata
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/Distropacks#Metadata'" >> /tmp/RELEASE_NOTE.md
echo "Download|Install: 'https://github.com/Azathothas/Distropacks#install'" >> /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: Git Pull
run: |
cd "$GITHUB_WORKSPACE/main" && git pull origin main
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
- 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 📦DistroPacks🗄️ <-- ${{ env.NEPALI_TIME }} ⌚"
#push_options: '--force'
- name: Releaser
uses: softprops/[email protected]
with:
name: "DistroPacks Weekly ${{ env.SAFE_NEPALI_TIME }}"
tag_name: "distropacks_weekly_${{ 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/*
continue-on-error: true
#------------------------------------------------------------------------------------#