@@ -167,6 +167,11 @@ jobs:
167167 - name : Set up QEMU for cross-arch containers
168168 uses : docker/setup-qemu-action@v3
169169
170+ - name : Setup Python
171+ uses : actions/setup-python@v5
172+ with :
173+ python-version : " 3.11"
174+
170175 - name : Build Termux binaries (arm64 + armv7)
171176 shell : bash
172177 run : |
@@ -183,48 +188,59 @@ jobs:
183188
184189 mkdir -p release-assets termux-dist
185190
191+ # Build using Alpine Linux with QEMU for cross-compilation
192+ # This is more reliable than depending on Termux Docker images
186193 build_termux_arch () {
187- arch="$1"
188- platform="$2"
189- image ="$3"
194+ local arch="$1"
195+ local platform="$2"
196+ local qemu_arch ="$3"
190197
198+ echo "Building for Termux ${arch}..."
191199 rm -rf dist build *.spec || true
192200
201+ # Use Alpine with QEMU for reliable cross-platform builds
193202 docker run --rm --platform "$platform" \
194203 -v "$PWD:/work" \
195204 -w /work \
196- "$image" \
197- bash -lc '
205+ alpine:latest \
206+ sh -c '
198207 set -euo pipefail
199- echo "Building Termux binary for ${arch}"
200- pkg update -y
201- pkg install -y python clang make pkg-config libffi openssl rust binutils
202- python -m pip install --upgrade pip
203- pip install pyinstaller
208+ echo "Installing build dependencies..."
209+ apk add --no-cache python3 py3-pip make gcc musl-dev openssl-dev libffi-dev rust cargo
210+ echo "Installing Python packages..."
211+ python3 -m pip install --upgrade pip pyinstaller
204212 pip install -r requirements.txt
213+ echo "Building binary for '"'"'${arch}'"'"'..."
205214 pyinstaller --noconfirm --clean --onefile --name MasterHttpRelayVPN --paths src main.py
206215 '
207216
208217 if [ ! -f dist/MasterHttpRelayVPN ]; then
209- echo "Missing Termux binary output for ${arch}" >&2
218+ echo "ERROR: Missing binary output for ${arch}" >&2
210219 exit 1
211220 fi
212221 cp dist/MasterHttpRelayVPN "termux-dist/MasterHttpRelayVPN-${arch}"
213222 chmod +x "termux-dist/MasterHttpRelayVPN-${arch}"
223+ echo "✓ Successfully built for ${arch}"
214224 }
215225
216- build_termux_arch "arm64" "linux/arm64" "termux/termux-docker:aarch64"
217- build_termux_arch "armv7" "linux/arm/v7" "termux/termux-docker:arm"
226+ # Build both ARM architectures
227+ build_termux_arch "arm64" "linux/arm64" "aarch64"
228+ build_termux_arch "armv7" "linux/arm/v7" "arm"
218229
230+ echo ""
231+ echo "Packaging releases..."
219232 for arch in arm64 armv7; do
220233 staging="termux-staging-${arch}"
221234 rm -rf "$staging"
222235 mkdir -p "$staging"
223236 cp "termux-dist/MasterHttpRelayVPN-${arch}" "$staging/MasterHttpRelayVPN"
237+ chmod +x "$staging/MasterHttpRelayVPN"
238+
224239 [ -f config.example.json ] && cp config.example.json "$staging/"
225240 [ -f README.md ] && cp README.md "$staging/"
226241 [ -f README_FA.md ] && cp README_FA.md "$staging/"
227242
243+ # Create Termux launch script for native Termux environment
228244 printf '%s\n' \
229245 '#!/data/data/com.termux/files/usr/bin/bash' \
230246 'set -euo pipefail' \
@@ -236,17 +252,22 @@ jobs:
236252 archive="MasterHttpRelayVPN-${version}-termux-${arch}.zip"
237253 (cd "$staging" && zip -qr "../release-assets/${archive}" .)
238254
239- python - <<PY
240- import hashlib
241- from pathlib import Path
242- archive = Path("release-assets") / "${archive}"
243- digest = hashlib.sha256(archive.read_bytes()).hexdigest()
244- (archive.parent / f"{archive.name}.sha256").write_text(
245- f"{digest} {archive.name}\\n",
246- encoding="utf-8",
247- )
248- PY
255+ # Generate checksum
256+ python3 - <<PY
257+ import hashlib
258+ from pathlib import Path
259+ archive = Path("release-assets") / "${archive}"
260+ digest = hashlib.sha256(archive.read_bytes()).hexdigest()
261+ (archive.parent / f"{archive.name}.sha256").write_text(
262+ f"{digest} {archive.name}\\n",
263+ encoding="utf-8",
264+ )
265+ PY
266+ echo "✓ Packaged : $archive"
249267 done
268+
269+ echo ""
270+ ls -lah release-assets/
250271
251272 - name : Upload build artifacts
252273 uses : actions/upload-artifact@v4
0 commit comments