This repository has been archived by the owner on Jul 8, 2024. It is now read-only.
Fetch ngrok Binaries #347
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: Fetch ngrok Binaries | |
#MAX_RUNTIME: 15 Minutes 00 22 * * * [22:00 (10:00 PM) UTC --> (05H+45M) 03:45 AM NPT ] | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "00 22 * * *" | |
# https://crontab.guru | |
# https://savvytime.com/converter/utc-to-nepal-kathmandu | |
env: | |
DOWNLOAD_PAGE: "https://ngrok.com/download" | |
# export DOWNLOAD_PAGE="https://ngrok.com/download" | |
USER_AGENT: "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0" | |
# export USER_AGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0" | |
GITHUB_TOKEN: ${{ secrets.STATIC_BINARIES_RELEASER }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
path: main | |
filter: "blob:none" #https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/ | |
- name: Check Version | |
id: check_version | |
run: | | |
#Download a testb-bin & run | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'linux-amd64.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
chmod +xwr "./ngrok" | |
# Get latest version | |
export VERSION=$("./ngrok" --version | grep -o '[0-9.]\+') | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
# Get stored version | |
export STORED_VERSION=$(cat $GITHUB_WORKSPACE/main/ngrok/version.txt) | |
if [ "$VERSION" == "$STORED_VERSION" ]; then | |
echo "Version $VERSION is already built & compiled" | |
echo "versions_same=true" >> $GITHUB_ENV | |
else | |
echo "Building... --> v$VERSION (from <-- v$STORED_VERSION)" | |
echo "versions_same=false" >> $GITHUB_ENV | |
fi | |
shell: bash | |
- name: Compare Versions | |
if: env.versions_same != 'true' | |
run: | | |
# Update version.txt with the latest version | |
echo $VERSION > $GITHUB_WORKSPACE/main/ngrok/version.txt | |
echo "Updated version.txt with the latest version $VERSION" | |
- name: Install CoreUtils | |
if: env.versions_same != 'true' | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y --no-install-recommends bison build-essential ca-certificates flex file jq pkg-config qemu-user-static wget | |
- name: Install upX | |
if: env.versions_same != 'true' | |
run: | | |
cd $(mktemp -d) && curl -qfLJO "$(curl -s 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)" \; | |
sudo chmod +xwr "$(which upx)" | |
continue-on-error: true | |
- name: Setup Env | |
if: env.versions_same != 'true' | |
run: | | |
# Create Output Dir | |
mkdir -p "$GITHUB_WORKSPACE/main/ngrok" | |
- name: Download @Latest Releases | |
if: env.versions_same != 'true' | |
run: | | |
#Download | |
set -x ; set +e | |
#-------------------------# | |
#FreeBSD | |
#arm | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'freebsd-arm.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_arm_FreeBSD" \; | |
#amd_x86_64 | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'freebsd-amd64.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_amd_x86_64_FreeBSD" \; | |
#386 | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'freebsd-386.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_386_FreeBSD" \; | |
#-------------------------# | |
#Linux | |
#aarch64_arm64 | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'linux-arm64.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_aarch64_arm64_Linux" \; | |
#amd64_x86_64 | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'linux-amd64.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_amd_x86_64_Linux" \; | |
#arm | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'linux-arm.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_arm_Linux" \; | |
#i386 | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'linux-386.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_i386_Linux" \; | |
#mips | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'linux-mips.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_mips_Linux" \; | |
#mipsle | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'linux-mipsle.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_mipsle_Linux" \; | |
#mips64 | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'linux-mips64.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_mips64_Linux" \; | |
#mips64le | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'linux-mips64le.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_mips64le_Linux" \; | |
#ppc64 | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'linux-ppc64.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_powerpc64_Linux" \; | |
#ppc64le | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'linux-ppc64le.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_powerpc64le_Linux" \; | |
#s390x | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'linux-s390x.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_s390x_Linux" \; | |
#-------------------------# | |
#macOS | |
#aarch64_arm64 | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'darwin-arm64.zip') | |
find . -type f -name '*.zip*' -exec unzip -o {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_aarch64_arm64_macOS" \; | |
#amd64_x86_64 | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'darwin-amd64.zip') | |
find . -type f -name '*.zip*' -exec unzip -o {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_amd_x86_64_macOS" \; | |
#-------------------------# | |
#Solaris | |
#amd_x86_64 | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'solaris-amd64.tgz') | |
find . -type f -name '*.tgz' -exec tar -xzvf {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name 'ngrok*' ! -name '*.*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_amd_x86_64_Solaris" \; | |
#-------------------------# | |
#Windows | |
#Windows 32-bit | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'windows-386.zip') | |
find . -type f -name '*.zip*' -exec unzip -o {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name '*ngrok.exe*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_amd_x86_Windows.exe" \; | |
#Windows x86_64_amd64 | |
cd $(mktemp -d) && curl -qfLJO $(curl -qfsSL "$DOWNLOAD_PAGE" -H "User-Agent: $USER_AGENT" | grep -o 'https://bin.equinox.io[^"]*' | grep 'windows-amd64.zip') | |
find . -type f -name '*.zip*' -exec unzip -o {} \; | |
find . -type f -name 'ngrok*' -exec strip {} \; >/dev/null 2>&1 | |
find . -type f -name '*ngrok.exe*' -exec mv {} "$GITHUB_WORKSPACE/main/ngrok/ngrok_amd_x86_64_Windows.exe" \; | |
#Change Perms | |
sudo chmod +xwr $GITHUB_WORKSPACE/main/ngrok/ngrok_* | |
set +x | |
continue-on-error: true | |
- name: Wait for UPX | |
if: env.versions_same != 'true' | |
run: | | |
while ps aux | grep -q "[u]px"; do | |
echo "Waiting for upx processes to finish..." | |
ps aux | grep "[u]px" | |
sleep 20 | |
done | |
shell: bash | |
continue-on-error: false | |
#Cleanup | |
- name: Cleanup >> Strip >> chmod | |
if: env.versions_same != 'true' | |
run: | | |
#Strip All Linux Bins | |
find "$GITHUB_WORKSPACE/main/ngrok/" -type f -name '*_Linux' -exec strip {} \; >/dev/null 2>&1 | |
#chmod +xwr everything | |
find "$GITHUB_WORKSPACE/main/ngrok/" -type f -name 'ngrok*' -exec chmod +xwr {} \; >/dev/null 2>&1 | |
continue-on-error: true | |
- name: Update README.md | |
if: env.versions_same != 'true' | |
run: | | |
cd "$GITHUB_WORKSPACE/main" | |
cat ./ngrok/INFO.md > ./ngrok/README.md | |
echo -e "" >> ./ngrok/README.md | |
echo '---' >> ./ngrok/README.md | |
echo '```console' >> ./ngrok/README.md | |
echo -e "" >> ./ngrok/README.md | |
echo -e "--> METADATA" >> ./ngrok/README.md | |
/bin/bash -c 'PS4="$ "; file ./ngrok/ngrok_* | grep -v '.txt' '&>> ./ngrok/README.md | |
echo -e "" >> ./ngrok/README.md | |
echo -e "--> SHA256SUM" >> ./ngrok/README.md | |
/bin/bash -c 'PS4="$ ";sha256sum ./ngrok/ngrok_* | grep -v '.txt' ' &>> ./ngrok/README.md | |
echo -e '```\n' >> ./ngrok/README.md | |
echo -e "" >> ./ngrok/README.md | |
echo '---' >> ./ngrok/README.md | |
echo -e "" >> ./ngrok/README.md | |
echo '- #### Version' >> ./ngrok/README.md | |
echo '```console' >> ./ngrok/README.md | |
/bin/bash -c 'PS4="$ "; ./ngrok/ngrok_amd_x86_64_Linux --version' &>> ./ngrok/README.md | |
echo -e "" >> ./ngrok/README.md | |
/bin/bash -c 'PS4="$ "; ./ngrok/ngrok_amd_x86_64_Linux --help' &>> ./ngrok/README.md | |
echo '```' >> ./ngrok/README.md | |
echo -e "" >> ./ngrok/README.md | |
echo '---' >> ./ngrok/README.md | |
echo -e "" >> ./ngrok/README.md | |
echo '- #### Sizes' >> ./ngrok/README.md | |
echo -e "" >> ./ngrok/README.md | |
echo '```console' >> ./ngrok/README.md | |
/bin/bash -c 'PS4="$ "; ls -lh ./ngrok/ngrok* | grep -v '.txt' | awk "{print \$5, \$9}" | column -t' &>> ./ngrok/README.md | |
echo -e "" >> ./ngrok/README.md | |
echo '```' >> ./ngrok/README.md | |
echo -e "" >> ./ngrok/README.md | |
working-directory: main | |
continue-on-error: true | |
- name: Git Pull | |
run: | | |
cd "$GITHUB_WORKSPACE/main" && git pull origin main | |
continue-on-error: true | |
- name: Get DateTime | |
if: env.versions_same != 'true' | |
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 latest ngrok Bins 📦 <-- v${{ env.VERSION }} at ${{ env.NEPALI_TIME }} ⌚" | |
#push_options: '--force' | |
#Create a new Release & Publish | |
# Repo: https://github.com/softprops/action-gh-release | |
# Market-Place: https://github.com/marketplace/actions/gh-release | |
- name: Releaser | |
if: env.versions_same != 'true' | |
uses: softprops/[email protected] | |
with: | |
name: "ngrok ${{ env.VERSION }}" | |
tag_name: "ngrok_${{ env.VERSION }}" | |
prerelease: false | |
draft: false | |
generate_release_notes: false | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
body: | | |
`Changelog`: _https://ngrok.com/docs/secure-tunnels/ngrok-agent/reference/changelog_ | |
`Install`: _https://github.com/Azathothas/Static-Binaries/tree/main/ngrok#install-ngrok_ | |
files: | | |
${{github.workspace}}/main/ngrok/*.exe | |
${{github.workspace}}/main/ngrok/*_FreeBSD | |
${{github.workspace}}/main/ngrok/*_Linux | |
${{github.workspace}}/main/ngrok/*_macOS | |
${{github.workspace}}/main/ngrok/*_Solaris |