Skip to content

Commit 34a62ce

Browse files
committed
fix release workflow cross-platform packaging failures
1 parent 1a390e5 commit 34a62ce

1 file changed

Lines changed: 33 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Release
22

3+
env:
4+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
5+
36
on:
47
push:
58
tags:
@@ -94,8 +97,10 @@ jobs:
9497
shell: pwsh
9598
run: |
9699
$ErrorActionPreference = "Stop"
97-
$version = ((Get-Content "src/core/constants.py" -Raw) -match '__version__\s*=\s*"([^"]+)"') > $null; $Matches[1]
98-
if (-not $version) { throw "Could not read version" }
100+
$content = Get-Content "src/core/constants.py" -Raw
101+
$m = [regex]::Match($content, '__version__\s*=\s*"([^"]+)"')
102+
if (-not $m.Success) { throw "Could not read version from src/core/constants.py" }
103+
$version = $m.Groups[1].Value
99104
New-Item -ItemType Directory -Path "release-assets" -Force | Out-Null
100105
$staging = "release-staging"
101106
Remove-Item -Recurse -Force $staging -ErrorAction SilentlyContinue
@@ -131,7 +136,18 @@ jobs:
131136
done
132137
archive="MasterHttpRelayVPN-${version}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz"
133138
tar -C release-staging -czf "release-assets/$archive" .
134-
sha256sum "release-assets/$archive" | awk '{print $1 " " FILENAME}' FILENAME="$archive" > "release-assets/$archive.sha256"
139+
ARCHIVE_NAME="$archive" python - <<'PY'
140+
import hashlib
141+
import os
142+
from pathlib import Path
143+
144+
archive = Path("release-assets") / os.environ["ARCHIVE_NAME"]
145+
digest = hashlib.sha256(archive.read_bytes()).hexdigest()
146+
(archive.parent / f"{archive.name}.sha256").write_text(
147+
f"{digest} {archive.name}\n",
148+
encoding="utf-8",
149+
)
150+
PY
135151
136152
- name: Upload build artifacts
137153
uses: actions/upload-artifact@v4
@@ -148,6 +164,9 @@ jobs:
148164
- name: Checkout
149165
uses: actions/checkout@v4
150166

167+
- name: Set up QEMU for cross-arch containers
168+
uses: docker/setup-qemu-action@v3
169+
151170
- name: Build Termux binaries (arm64 + armv7)
152171
shell: bash
153172
run: |
@@ -177,6 +196,7 @@ jobs:
177196
"$image" \
178197
bash -lc '
179198
set -euo pipefail
199+
echo "Building Termux binary for ${arch}"
180200
pkg update -y
181201
pkg install -y python clang make pkg-config libffi openssl rust binutils
182202
python -m pip install --upgrade pip
@@ -216,7 +236,16 @@ jobs:
216236
archive="MasterHttpRelayVPN-${version}-termux-${arch}.zip"
217237
(cd "$staging" && zip -qr "../release-assets/${archive}" .)
218238
219-
sha256sum "release-assets/${archive}" | awk '{print $1 " " FILENAME}' FILENAME="$archive" > "release-assets/${archive}.sha256"
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
220249
done
221250
222251
- name: Upload build artifacts

0 commit comments

Comments
 (0)