Files
ObsiGate/desktop/build-windows.bat
T
bruno 8ddee212e5
CI / lint (push) Successful in 1m7s
CI / security (push) Successful in 43s
CI / test (push) Successful in 2m12s
CI / build (push) Successful in 42s
CI / e2e (push) Successful in 10m43s
Desktop Build / build-windows (push) Canceled after 0s
Desktop Build / build-linux (push) Canceled after 0s
feat(desktop): manifeste de mise a jour latest.json + builds locaux signes (#77)
- scripts/updater_manifest.py : construit latest.json (version, pub_date, platforms Windows/Linux avec signature .sig et URLs des assets).

- publish_release.py : genere latest.json, upload des .sig + latest.json, rappel de commit.

- tauri.conf.json : endpoint updater -> raw/branch/main/desktop/latest.json.

- build-windows.bat / build-linux.sh : detection automatique de obsigate-updater.key (signature) ou repli non signe.

- .gitignore : ignore desktop/key/ ; tests/test_updater_manifest.py (8 tests).
2026-09-12 10:01:56 -04:00

101 lines
4.3 KiB
Batchfile

@echo off
REM ============================================================
REM ObsiGate Desktop — Build Windows (NSIS installer)
REM Prérequis : Rust, Tauri CLI, NSIS, Python 3.11 embed
REM ============================================================
setlocal enabledelayedexpansion
echo ========================================
echo ObsiGate Desktop — Build Windows
echo ========================================
echo.
REM ── 0. Kill any leftover backend from a previous run ──────────
echo [0/6] Killing leftover Python processes...
taskkill /F /IM python.exe 2>nul
echo.
REM ── 1. Vérifier les prérequis ─────────────────────────────────
echo [1/6] Verifying prerequisites...
where cargo >nul 2>&1 || (echo ❌ Rust/Cargo not found. Install from https://rustup.rs & exit /b 1)
where tauri >nul 2>&1 || cargo install tauri-cli
echo ✅ Rust + Tauri OK
REM ── 2. Préparer Python 3.11 embed ─────────────────────────────
echo [2/6] Preparing Python embed...
echo 📥 Downloading Python 3.11 embed...
if exist "python-embed" rmdir /s /q "python-embed"
curl -L -o python-embed.zip "https://www.python.org/ftp/python/3.11.9/python-3.11.9-embed-amd64.zip"
powershell Expand-Archive -Path python-embed.zip -DestinationPath python-embed\
del python-embed.zip
REM Enable pip and site-packages + parent dir for 'import backend'
echo import site >> python-embed\python311._pth
echo ..>> python-embed\python311._pth
REM Download get-pip.py (embed Python doesn't include ensurepip)
echo 📥 Downloading get-pip.py...
curl -L -o get-pip.py "https://bootstrap.pypa.io/get-pip.py"
python-embed\python.exe get-pip.py --no-cache-dir
del get-pip.py
REM Install dependencies
python-embed\python.exe -m pip install --no-cache-dir -r ..\backend\requirements.txt
echo ✅ Python embed ready
REM ── 2b. Copier backend + frontend localement pour le bundle ────
echo [2b/6] Staging backend + frontend for bundle...
if exist "backend" rmdir /s /q "backend"
if exist "frontend" rmdir /s /q "frontend"
xcopy /E /I /Q /Y "..\backend" "backend"
xcopy /E /I /Q /Y "..\frontend" "frontend"
echo ✅ Staged
REM ── 2c. Clé de signature des mises à jour (updater Tauri) ──────
set "SIGN_CONFIG="
if exist "obsigate-updater.key" (
set /p TAURI_SIGNING_PRIVATE_KEY=<obsigate-updater.key
echo [2c/6] Cle updater trouvee - artefacts .sig actives
) else (
> updater-off.json echo {"bundle":{"createUpdaterArtifacts":false}}
set "SIGN_CONFIG=--config updater-off.json"
echo [2c/6] Cle updater absente - build sans .sig
)
REM ── 3. Build Tauri ────────────────────────────────────────────
echo [3/6] Building Tauri application (NSIS + MSI installers)...
cargo tauri build --target x86_64-pc-windows-msvc --bundles nsis,msi %SIGN_CONFIG%
if errorlevel 1 (
echo ⚠️ Standard bundle build failed, trying fallback to NSIS only...
cargo tauri build --target x86_64-pc-windows-msvc --bundles nsis %SIGN_CONFIG%
if errorlevel 1 (
echo ❌ Build failed!
goto :cleanup
)
)
echo ✅ Build successful
REM ── 4. Copier python-embed vers output dir (dev local) ─────────
echo [4/6] Copying python-embed to output dir...
set "OUTDIR=target\x86_64-pc-windows-msvc\release"
if exist "%OUTDIR%\python-embed" rmdir /s /q "%OUTDIR%\python-embed" 2>nul
xcopy /E /I /Q /Y "python-embed" "%OUTDIR%\python-embed"
echo ..>> "%OUTDIR%\python-embed\python311._pth"
echo ✅ Dev runtime ready
:cleanup
REM ── 5. Nettoyer les dossiers stagés ───────────────────────────
echo [5/6] Cleaning up staged dirs...
if exist "backend" rmdir /s /q "backend"
if exist "frontend" rmdir /s /q "frontend"
if exist "updater-off.json" del /q "updater-off.json"
echo ✅ Cleaned
REM ── 6. Résultats ───────────────────────────────────────────────
echo [6/6] Binaries generated:
dir /b "%OUTDIR%\bundle\nsis\*.exe" 2>nul
dir /b "%OUTDIR%\bundle\msi\*.msi" 2>nul
echo.
echo ✅ Done! Installers generated in: %OUTDIR%\bundle\
endlocal