Cross-compiles gh (GitHub CLI) as a statically-linked binary for OpenWrt routers running musl libc on aarch64.
- Go 1.26+ installed on the build host
- GitHub CLI source checkout at
../github/cli(relative to this project) sshpassfor automated router deploymentupx(optional) for binary compression
make buildThis cross-compiles gh and outputs the binary to bin/gh-openwrt-arm64.
make deployThis copies the binary to the router at /mnt/appdata/bin/gh, creates a symlink at /usr/bin/gh, and bootstraps authentication from the existing orchestrator config.
If you prefer manual auth on the router:
ssh root@10.0.0.1
echo "YOUR_GITHUB_PAT" | /mnt/appdata/bin/gh auth login --with-token
gh auth statusA GitHub Actions workflow checks for new cli/cli releases every 6 hours. When a new version is detected:
- Clones the upstream tag
- Cross-compiles for
linux/arm64withCGO_ENABLED=0(static, stripped) - Compresses with UPX
- Publishes a GitHub Release with the binary and checksums
You can also trigger a build manually from the Actions tab with an optional force-rebuild flag.
# On the router
wget -O /mnt/appdata/bin/gh https://github.com/RPDevs-Vault/github-openwrt/releases/latest/download/gh-openwrt-arm64-uncompressed
chmod +x /mnt/appdata/bin/gh
ln -sf /mnt/appdata/bin/gh /usr/bin/ghWith gh available on the router, the orchestrator can optionally use gh api instead of raw curl calls for:
- Automatic token management (no need to pass
-H "Authorization: token ...") - Built-in pagination for large result sets
- Richer error handling and retry logic
