Merge origin/main: Navis 2.7.2+2 with app icon and update UX.
Combine remote update check/skip flow with green N AppIcon packaging for macOS. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,67 +1,39 @@
|
||||
#!/bin/bash
|
||||
# Build Navis GUI for Apple Silicon (arm64) with auto-incremented build number.
|
||||
# Build Navis GUI for Apple Silicon (arm64).
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
BASE_VERSION="$(python3 - <<'PY'
|
||||
VERSION="$(python3 - <<'PY'
|
||||
import re
|
||||
from pathlib import Path
|
||||
t = Path('internal/update/version.go').read_text()
|
||||
m = re.search(r'BaseVersion\s*=\s*"([^"]+)"', t)
|
||||
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_NUM="$(tr -d '[:space:]' < buildnum.txt 2>/dev/null || echo 0)"
|
||||
if ! [[ "$BUILD_NUM" =~ ^[0-9]+$ ]]; then BUILD_NUM=0; fi
|
||||
BUILD_NUM=$((BUILD_NUM + 1))
|
||||
echo "$BUILD_NUM" > buildnum.txt
|
||||
|
||||
FULL_VERSION="${BASE_VERSION}.${BUILD_NUM}"
|
||||
echo "Building Navis ${FULL_VERSION} (arm64)..."
|
||||
|
||||
# Keep source BuildNumber in sync for non-ldflags runs / IDE
|
||||
python3 - <<PY
|
||||
from pathlib import Path
|
||||
p = Path('internal/update/version.go')
|
||||
t = p.read_text()
|
||||
BUILD="$(python3 - <<'PY'
|
||||
import re
|
||||
t2 = re.sub(r'(var BuildNumber = ")[^"]*(")', r'\g<1>${BUILD_NUM}\2', t)
|
||||
p.write_text(t2)
|
||||
PY
|
||||
|
||||
# versioninfo.json (Windows metadata; also documents build)
|
||||
python3 - <<PY
|
||||
import json, re
|
||||
from pathlib import Path
|
||||
maj, minor, patch = [int(x) for x in "${BASE_VERSION}".split(".")[:3]]
|
||||
build = int("${BUILD_NUM}")
|
||||
full = "${FULL_VERSION}"
|
||||
p = Path('versioninfo.json')
|
||||
d = json.loads(p.read_text())
|
||||
d['FixedFileInfo']['FileVersion'] = {"Major": maj, "Minor": minor, "Patch": patch, "Build": build}
|
||||
d['FixedFileInfo']['ProductVersion'] = {"Major": maj, "Minor": minor, "Patch": patch, "Build": build}
|
||||
d['StringFileInfo']['FileVersion'] = f"{full}.0" if full.count('.')==3 else full
|
||||
d['StringFileInfo']['ProductVersion'] = d['StringFileInfo']['FileVersion']
|
||||
# Prefer 4-part a.b.c.d
|
||||
d['StringFileInfo']['FileVersion'] = f"{maj}.{minor}.{patch}.{build}"
|
||||
d['StringFileInfo']['ProductVersion'] = f"{maj}.{minor}.{patch}.{build}"
|
||||
p.write_text(json.dumps(d, indent=2) + "\n")
|
||||
print('versioninfo.json ->', d['StringFileInfo']['FileVersion'])
|
||||
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 -X vpnclient/internal/update.BuildNumber=${BUILD_NUM}"
|
||||
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
|
||||
|
||||
# Stamp plain-text version next to binaries
|
||||
printf '%s\n' "$FULL_VERSION" > "$OUT/VERSION"
|
||||
printf '%s\n' "$FULL_VERSION" > "$OUT/Navis.version"
|
||||
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"
|
||||
@@ -72,35 +44,35 @@ go build -o tools/packmac/packmac ./tools/packmac
|
||||
tools/packmac/packmac \
|
||||
-bin "$OUT/Navis" \
|
||||
-out "$OUT" \
|
||||
-version "$FULL_VERSION" \
|
||||
-build "$BUILD_NUM" \
|
||||
-version "$VERSION" \
|
||||
-build "$FULL" \
|
||||
-arch arm64
|
||||
|
||||
# Rename release copies with version in filename (keep unversioned too)
|
||||
cp -f "$OUT/Navis.dmg" "$OUT/Navis-${FULL_VERSION}-arm64.dmg"
|
||||
cp -f "$OUT/Navis.app.zip" "$OUT/Navis-${FULL_VERSION}-arm64.app.zip"
|
||||
cp -f "$OUT/Navis.dmg" "$OUT/Navis-${FULL}-arm64.dmg"
|
||||
cp -f "$OUT/Navis.app.zip" "$OUT/Navis-${FULL}-arm64.app.zip"
|
||||
|
||||
# update.json
|
||||
python3 - <<PY
|
||||
import hashlib, json
|
||||
from pathlib import Path
|
||||
full = "${FULL_VERSION}"
|
||||
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'] = full
|
||||
d['notes'] = f'Navis {full}'
|
||||
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, '->', full)
|
||||
print('updated', p, '->', ver, 'sha', h[:12])
|
||||
PY
|
||||
|
||||
echo ""
|
||||
echo "Done: Navis ${FULL_VERSION}"
|
||||
echo "Done: Navis ${VERSION}+${BUILD}"
|
||||
ls -lh "$OUT"
|
||||
file "$OUT/Navis.dmg"
|
||||
|
||||
@@ -17,7 +17,7 @@ DEST="${1:-$HOME/Downloads/Navis.dmg}"
|
||||
UNIVERSAL="$BASE/darwin-universal/Navis.dmg"
|
||||
SPECIFIC="$BASE/$SUBDIR/Navis.dmg"
|
||||
|
||||
echo "Mac: $ARCH · ставим Navis GUI 2.7"
|
||||
echo "Mac: $ARCH · ставим Navis GUI 2.7.1"
|
||||
echo "Скачиваю универсальный DMG…"
|
||||
if ! curl -fL -o "$DEST" "$UNIVERSAL"; then
|
||||
echo "Universal недоступен, скачиваю $SUBDIR…"
|
||||
|
||||
Reference in New Issue
Block a user