Combine remote update check/skip flow with green N AppIcon packaging for macOS. Co-authored-by: Cursor <cursoragent@cursor.com>
79 lines
2.3 KiB
Bash
Executable File
79 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build Navis GUI for Apple Silicon (arm64).
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
VERSION="$(python3 - <<'PY'
|
|
import re
|
|
from pathlib import Path
|
|
t = Path('internal/update/update.go').read_text()
|
|
m = re.search(r'CurrentVersion\s*=\s*"([^"]+)"', t)
|
|
print(m.group(1) if m else '0.0.0')
|
|
PY
|
|
)"
|
|
BUILD="$(python3 - <<'PY'
|
|
import re
|
|
from pathlib import Path
|
|
t = Path('internal/update/update.go').read_text()
|
|
m = re.search(r'const BuildNumber\s*=\s*(\d+)', t)
|
|
print(m.group(1) if m else '0')
|
|
PY
|
|
)"
|
|
FULL="${VERSION}.${BUILD}"
|
|
echo "Building Navis ${VERSION}+${BUILD} (arm64)..."
|
|
|
|
OUT="dist/navis-release/darwin-arm64"
|
|
mkdir -p "$OUT"
|
|
LDFLAGS="-s -w"
|
|
|
|
export PATH="/tmp/go-sdk/go/bin:/usr/local/go/bin:$PATH"
|
|
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 \
|
|
go build -ldflags="$LDFLAGS" -trimpath -o "$OUT/Navis" ./cmd/vpnapp
|
|
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 \
|
|
go build -ldflags="$LDFLAGS" -trimpath -o "$OUT/Navis-cli" ./cmd/vpnclient
|
|
|
|
printf '%s\n' "$FULL" > "$OUT/VERSION"
|
|
printf '%s\n' "${VERSION}+${BUILD}" > "$OUT/Navis.version"
|
|
|
|
if command -v codesign >/dev/null 2>&1; then
|
|
codesign -s - --force "$OUT/Navis"
|
|
codesign -s - --force "$OUT/Navis-cli"
|
|
fi
|
|
|
|
go build -o tools/packmac/packmac ./tools/packmac
|
|
tools/packmac/packmac \
|
|
-bin "$OUT/Navis" \
|
|
-out "$OUT" \
|
|
-version "$VERSION" \
|
|
-build "$FULL" \
|
|
-arch arm64
|
|
|
|
cp -f "$OUT/Navis.dmg" "$OUT/Navis-${FULL}-arm64.dmg"
|
|
cp -f "$OUT/Navis.app.zip" "$OUT/Navis-${FULL}-arm64.app.zip"
|
|
|
|
python3 - <<PY
|
|
import hashlib, json
|
|
from pathlib import Path
|
|
ver = "${VERSION}"
|
|
build = "${BUILD}"
|
|
full = "${FULL}"
|
|
binp = Path('dist/navis-release/darwin-arm64/Navis')
|
|
h = hashlib.sha256(binp.read_bytes()).hexdigest()
|
|
notes = f"Navis {ver}+{build}: иконка приложения (N), macOS AppIcon; обновление только по кнопке."
|
|
for p in [Path('dist/update.json'), Path('dist/navis-release/update.json')]:
|
|
if not p.exists():
|
|
continue
|
|
d = json.loads(p.read_text())
|
|
d['version'] = ver
|
|
d['notes'] = notes
|
|
plats = d.setdefault('platforms', {})
|
|
if 'darwin-arm64' in plats:
|
|
plats['darwin-arm64']['sha256'] = h
|
|
p.write_text(json.dumps(d, ensure_ascii=False, indent=2) + '\n')
|
|
print('updated', p, '->', ver, 'sha', h[:12])
|
|
PY
|
|
|
|
echo ""
|
|
echo "Done: Navis ${VERSION}+${BUILD}"
|
|
ls -lh "$OUT"
|