Skip to content

Commit

Permalink
Create fetch_weekly_toolpack_aarch64_arm64_v8a_Android.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
Azathothas authored Nov 6, 2023
1 parent ee9cfcf commit b26814d
Showing 1 changed file with 176 additions and 0 deletions.
176 changes: 176 additions & 0 deletions .github/workflows/fetch_weekly_toolpack_aarch64_arm64_v8a_Android.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
name: 🛍️ Fetch ⚙️ Weekly (aarch64_arm64_v8a_Android) 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
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 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: Download TailScale
run: |
#Presets
set -x ; set +e
#--------------#
#tailscale
eget "https://github.com/Azathothas/Static-Binaries/raw/main/tailscale/tailscale_aarch64_arm64_Linux" --to "$GITHUB_WORKSPACE/main/aarch64_arm64_v8a_Android/tailscale"
#tailscale_merged
eget "https://github.com/Azathothas/Static-Binaries/raw/main/tailscale/tailscale_merged_aarch64_arm64_Linux" --to "$GITHUB_WORKSPACE/main/aarch64_arm64_v8a_Android/tailscale_merged"
#tailscaled
eget "https://github.com/Azathothas/Static-Binaries/raw/main/tailscale/tailscaled_aarch64_arm64_Linux" --to "$GITHUB_WORKSPACE/main/aarch64_arm64_v8a_Android/tailscaled"
continue-on-error: true

#Build using go tool chain
#Complete Tool Chain List: `go tool dist list`
# - name: Build Tailscale for dockcross/android-aarch64_arm64_v8a_Android
# run: |
# #This is dynamic, and has many many limitations
# #Better to keep using aarch64 binaries
# cd $(mktemp -d) && curl -LOJ $(curl -s https://api.github.com/repos/tailscale/tailscale/releases/latest | jq -r '.zipball_url')
# find . -type f -name '*.zip*' -exec unzip -o {} \;
# cd $(find . -maxdepth 1 -type d | grep -v '^.$')
# docker run --privileged -v $(pwd):/work dockcross/android-arm64 bash -c "bash <(curl -sL https://git.io/go-installer) ; export PATH=/root/.go/bin:$PATH ; export PATH=/root/go/bin:$PATH ; GOOS=android GOARCH=arm64 CGO_ENABLED=0 /root/.go/bin/go build -v -ldflags=\"-s -w -extldflags '-static'\" \"./cmd/tailscale\""
# docker run --privileged -v $(pwd):/work dockcross/android-arm64 bash -c "bash <(curl -sL https://git.io/go-installer) ; export PATH=/root/.go/bin:$PATH ; export PATH=/root/go/bin:$PATH ; GOOS=android GOARCH=arm64 CGO_ENABLED=0 /root/.go/bin/go build -v -ldflags=\"-s -w -extldflags '-static'\" \"./cmd/tailscaled\""
# #Strip & move
# strip "./tailscale" "./tailscaled" 2>/dev/null
# mv "./tailscale" "$GITHUB_WORKSPACE/main/aarch64_arm64_v8a_Android/tailscale_dynamic_native"
# mv "./tailscaled" "$GITHUB_WORKSPACE/main/aarch64_arm64_v8a_Android/tailscaled_dynamic_native"
# # Remove tmp files
# #rm -rf /tmp >/dev/null 2>&1
# ERROR: loadinternal: cannot find runtime/cgo

- name: Strip || Cleanup
run: |
set +e
cd "$GITHUB_WORKSPACE/main/aarch64_arm64_v8a_Android"
find "$GITHUB_WORKSPACE/main/aarch64_arm64_v8a_Android" -maxdepth 1 -type f -exec strip {} \; 2>/dev/null
# Strip && Rename anything with *_amd*
# find "$GITHUB_WORKSPACE/main/aarch64_arm64_v8a_Android" -type f -name '*_Linux' -exec sh -c 'newname=$(echo "$1" | sed "s/_amd_aarch64_arm64_v8a_Android_Linux//"); mv "$1" "$newname"' sh {} \;
continue-on-error: true

- name: Update README.md
run: |
set -x ; set +e
cd "$GITHUB_WORKSPACE/main"
echo -e "" > "./aarch64_arm64_v8a_Android/README.md"
echo '---' >> "./aarch64_arm64_v8a_Android/README.md"
echo '```console' >> "./aarch64_arm64_v8a_Android/README.md"
echo -e "" >> "./aarch64_arm64_v8a_Android/README.md"
echo -e "--> METATDATA" >> "./aarch64_arm64_v8a_Android/README.md"
/bin/bash -c 'PS4="$ "; file ./aarch64_arm64_v8a_Android/* | grep -v '.txt' ' &>> "./aarch64_arm64_v8a_Android/README.md"
echo -e "" >> "./aarch64_arm64_v8a_Android/README.md"
echo -e "--> SHA256SUM" >> "./aarch64_arm64_v8a_Android/README.md"
/bin/bash -c 'PS4="$ ";sha256sum ./aarch64_arm64_v8a_Android/* | grep -v '.txt' ' &>> "./aarch64_arm64_v8a_Android/README.md"
echo -e '```\n' >> "./aarch64_arm64_v8a_Android/README.md"
echo -e "" >> "./aarch64_arm64_v8a_Android/README.md"
echo '---' >> "./aarch64_arm64_v8a_Android/README.md"
echo -e "" >> "./aarch64_arm64_v8a_Android/README.md"
echo '- #### Sizes' >> "./aarch64_arm64_v8a_Android/README.md"
echo -e "" >> "./aarch64_arm64_v8a_Android/README.md"
echo '```console' >> "./aarch64_arm64_v8a_Android/README.md"
/bin/bash -c 'PS4="$ ";ls -lh ./aarch64_arm64_v8a_Android/* | grep -v '.txt' | awk "{print \$5, \$9}" | column -t' &>> "./aarch64_arm64_v8a_Android/README.md"
echo -e "\n[+] Total Size: $(du -h ./aarch64_arm64_v8a_Android | awk '{print $1}')\n"
echo '```' >> "./aarch64_arm64_v8a_Android/README.md"
echo -e "" >> "./aarch64_arm64_v8a_Android/README.md"
echo '---' >> "./aarch64_arm64_v8a_Android/README.md"
echo -e "" >> "./aarch64_arm64_v8a_Android/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: "✅ 🛍️ Fetch ⚙️ Weekly (aarch64_arm64_v8a_Android) Package 📦🗄️ <-- ${{ env.NEPALI_TIME }} ⌚"
#push_options: '--force'

0 comments on commit b26814d

Please sign in to comment.