name: publish-nexus # Publication du .deb Linux d'ObsiGate Desktop dans le dépôt Nexus # « suite-dracodev » (obsigate-desktop//) : c'est là que la # page Télécharger du Hub et la commande d'installation en une # commande (stratégie Deb, HUB-28) vont le chercher. # Déclenché à la publication d'une release (le tag doit correspondre # au fichier VERSION, ex. v2.88.1), ou manuellement (onglet Actions # → publish-nexus → Run workflow) pour (re)publier la version # courante. # # Phases 4a (Linux, runner ubuntu-latest) et 4b (Windows, runner # laptop-win étiqueté windows-latest) de l'automatisation Nexus. # Le workflow desktop-build.yml existant, qui vise des runners # [self-hosted, linux/windows, desktop] inexistants, n'est pas # modifié. # # Aucun secret nouveau : NEXUS_USER / NEXUS_PASSWORD existent déjà # au niveau de l'organisation Projets (phase 1). La clé updater # Tauri est absente (comme en local) : build sans artefacts .sig, # via createUpdaterArtifacts:false — même comportement que # desktop/build-linux.sh sans clé. # # Les étapes reprennent desktop/build-linux.sh (la référence, # utilisée pour le .deb 2.87.1 publié) : # - venv Python À LA RACINE de desktop/python-embed/ (src/main.rs # lance « python-embed/bin/python3 » ; un sous-dossier venv/ # casserait le démarrage du backend empaqueté — le # desktop-build.yml existant fait l'inverse, à ne pas recopier) ; # - retrait des liens symboliques du venv (lib64, bin/python, # bin/python3.x) : le bundleur Tauri les déréférence, sans quoi # le .deb passe de ~58 Mo à ~139 Mo ; # - staging de backend/ et frontend/ dans desktop/ (ressources du # bundle dans tauri.conf.json). # Différence assumée : --bundles deb SEUL (pas d'AppImage : le Hub # ne sert que le .deb pour Linux, et l'AppImage de ~139 Mo dépasse # la limite d'envoi Cloudflare de ~100 Mo de toute façon). # Garde-fou : le job échoue si le .deb dépasse 95 Mo. # # Version : le fichier VERSION à la racine fait foi ; contrôle de # cohérence avec le « version » de desktop/tauri.conf.json (le nom # du .deb produit par Tauri en dépend : ObsiGate__amd64.deb). # # Durée attendue : longue (installation de tauri-cli par cargo + # compilation Rust) — premier run à lancer en manuel et à surveiller. on: release: types: [published] workflow_dispatch: jobs: publish: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Vérifier les secrets Nexus env: NEXUS_USER: ${{ secrets.NEXUS_USER }} NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} run: | if [ -z "$NEXUS_USER" ] || [ -z "$NEXUS_PASSWORD" ]; then echo "Secrets NEXUS_USER / NEXUS_PASSWORD absents (organisation Projets)." >&2 exit 1 fi - name: Déterminer la version run: | VER=$(tr -d ' \r\n' < VERSION) echo "VER=$VER" >> "$GITHUB_ENV" if [ -z "$VER" ]; then echo "Fichier VERSION vide ou absent." >&2 exit 1 fi CONF_VER=$(sed -n 's/.*"version": "\([^"]*\)".*/\1/p' desktop/tauri.conf.json | head -n 1) if [ "$CONF_VER" != "$VER" ]; then echo "Incohérence de version : VERSION=$VER mais tauri.conf.json=$CONF_VER. Alignez les deux avant de publier." >&2 exit 1 fi if [ "$GITHUB_EVENT_NAME" = "release" ] && [ "$GITHUB_REF_NAME" != "v$VER" ]; then echo "Le tag de la release ($GITHUB_REF_NAME) ne correspond pas à VERSION (v$VER) : publication annulée." >&2 exit 1 fi echo "Publication d'ObsiGate Desktop $VER (Linux .deb) dans Nexus suite-dracodev." - name: Dépendances système (Tauri 2, Linux) run: | SUDO=""; [ "$(id -u)" -ne 0 ] && SUDO="sudo" $SUDO apt-get update $SUDO apt-get install -y \ build-essential pkg-config curl file \ libwebkit2gtk-4.1-dev libgtk-3-dev \ libayatana-appindicator3-dev librsvg2-dev libssl-dev \ python3 python3-venv - name: Installer Rust et Tauri CLI run: | if ! command -v cargo >/dev/null 2>&1; then curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" export PATH="$HOME/.cargo/bin:$PATH" fi rustup default stable cargo install tauri-cli --version "^2.0" --locked cargo tauri --version - name: Préparer le runtime Python et le staging (comme build-linux.sh) working-directory: desktop run: | rm -rf python-embed python3 -m venv python-embed python-embed/bin/pip install --upgrade pip -q python-embed/bin/pip install -r ../backend/requirements.txt -q python-embed/bin/pip uninstall -y -q pip setuptools wheel || true rm -f python-embed/lib64 python-embed/bin/python python-embed/bin/python3.* # bin/python3 peut être un lien vers le python3.x retiré : le recréer si besoin if [ ! -e python-embed/bin/python3 ]; then cp "$(command -v python3)" python-embed/bin/python3 fi rm -rf backend frontend cp -r ../backend backend cp -r ../frontend frontend find python-embed -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true - name: Build Tauri (.deb seul, sans artefacts updater) working-directory: desktop run: | cargo tauri build --ci --target x86_64-unknown-linux-gnu --bundles deb \ --config '{"bundle":{"createUpdaterArtifacts":false}}' ls -lh target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb - name: Publier dans Nexus suite-dracodev env: NEXUS_USER: ${{ secrets.NEXUS_USER }} NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} run: | DEB=$(ls desktop/target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb | head -n 1) NOM=$(basename "$DEB") TAILLE=$(stat -c %s "$DEB") echo "$NOM : $TAILLE octets" if [ "$TAILLE" -gt 99614720 ]; then echo "Le .deb dépasse 95 Mo : envoi Nexus via Cloudflare impossible (~100 Mo max). Vérifier le nettoyage des liens symboliques du venv." >&2 exit 1 fi echo "Envoi de $NOM vers obsigate-desktop/$VER/" curl -fsS -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "$DEB" "https://nexus.dracodev.net/repository/suite-dracodev/obsigate-desktop/$VER/$NOM" echo "Publié : obsigate-desktop/$VER/$NOM dans suite-dracodev." echo "DEB_NOM=$NOM" >> "$GITHUB_ENV" cp "$DEB" "$RUNNER_TEMP/$NOM" - name: Vérifier le dépôt (retéléchargement + comparaison) env: NEXUS_USER: ${{ secrets.NEXUS_USER }} NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} run: | curl -fsS -u "$NEXUS_USER:$NEXUS_PASSWORD" -o "$RUNNER_TEMP/nexus-check.deb" "https://nexus.dracodev.net/repository/suite-dracodev/obsigate-desktop/$VER/$DEB_NOM" cmp "$RUNNER_TEMP/$DEB_NOM" "$RUNNER_TEMP/nexus-check.deb" || { echo "Dépôt Nexus non conforme pour $DEB_NOM (contenu différent du .deb local)." >&2; exit 1; } echo "Vérifié : $DEB_NOM (contenu identique au .deb construit)." publish-windows: runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Vérifier les secrets Nexus env: NEXUS_USER: ${{ secrets.NEXUS_USER }} NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} run: | if ([string]::IsNullOrEmpty($env:NEXUS_USER) -or [string]::IsNullOrEmpty($env:NEXUS_PASSWORD)) { Write-Error "Secrets NEXUS_USER / NEXUS_PASSWORD absents (organisation Projets)." exit 1 } - name: Déterminer la version run: | $ver = (Get-Content VERSION -Raw).Trim() if ([string]::IsNullOrEmpty($ver)) { Write-Error "Fichier VERSION vide ou absent." exit 1 } $conf = Get-Content desktop/tauri.conf.json -Raw | ConvertFrom-Json if ($conf.version -ne $ver) { Write-Error "Incohérence de version : VERSION=$ver mais tauri.conf.json=$($conf.version). Alignez les deux avant de publier." exit 1 } if ($env:GITHUB_EVENT_NAME -eq "release" -and $env:GITHUB_REF_NAME -ne "v$ver") { Write-Error "Le tag de la release ($env:GITHUB_REF_NAME) ne correspond pas à VERSION (v$ver) : publication annulée." exit 1 } [IO.File]::AppendAllText($env:GITHUB_ENV, "VER=$ver`n") Write-Host "Publication d'ObsiGate Desktop $ver (Windows NSIS + MSI) dans Nexus suite-dracodev." - name: Installer Rust et Tauri CLI run: | rustup default stable cargo tauri --version 2>$null if ($LASTEXITCODE -ne 0) { cargo install tauri-cli --version "^2.0" --locked if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } cargo tauri --version - name: Préparer Python 3.11 embed (comme build-windows.bat) working-directory: desktop run: | if (Test-Path python-embed) { Remove-Item -Recurse -Force python-embed } curl.exe -L --fail -o python-embed.zip "https://www.python.org/ftp/python/3.11.9/python-3.11.9-embed-amd64.zip" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } New-Item -ItemType Directory -Force python-embed | Out-Null tar -xf python-embed.zip -C python-embed if (-not (Test-Path python-embed\python.exe)) { Write-Error "Extraction de Python embed incomplète (python.exe absent)." exit 1 } Remove-Item python-embed.zip # ._pth écrit explicitement (stdlib + site-packages + « .. » # pour que « import backend » fonctionne à côté de l'exe). @("python311.zip", ".", "import site", "..") | Set-Content python-embed\python311._pth -Encoding ascii curl.exe -L --fail -o get-pip.py "https://bootstrap.pypa.io/get-pip.py" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } .\python-embed\python.exe get-pip.py --no-cache-dir if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } Remove-Item get-pip.py .\python-embed\python.exe -m pip install --no-cache-dir -r ..\backend\requirements.txt if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } .\python-embed\python.exe -c "import encodings, uvicorn, fastapi, pyotp" if ($LASTEXITCODE -ne 0) { Write-Error "Contrôle du runtime Python embarqué échoué (stdlib ou dépendances manquantes)." exit 1 } - name: Staging backend + frontend working-directory: desktop run: | if (Test-Path backend) { Remove-Item -Recurse -Force backend } if (Test-Path frontend) { Remove-Item -Recurse -Force frontend } Copy-Item -Recurse ..\backend backend Copy-Item -Recurse ..\frontend frontend - name: Build Tauri (NSIS + MSI, sans artefacts updater) working-directory: desktop run: | '{"bundle":{"createUpdaterArtifacts":false}}' | Set-Content updater-off.json -Encoding ascii cargo tauri build --ci --target x86_64-pc-windows-msvc --bundles nsis,msi --config updater-off.json if ($LASTEXITCODE -ne 0) { Write-Host "Échec du build combiné : repli NSIS seul (comme build-windows.bat)." cargo tauri build --ci --target x86_64-pc-windows-msvc --bundles nsis --config updater-off.json if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } Get-ChildItem target\x86_64-pc-windows-msvc\release\bundle\nsis\*.exe, target\x86_64-pc-windows-msvc\release\bundle\msi\*.msi -ErrorAction SilentlyContinue | Select-Object Name, Length - name: Publier dans Nexus suite-dracodev env: NEXUS_USER: ${{ secrets.NEXUS_USER }} NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} run: | $fichiers = @() $fichiers += Get-ChildItem desktop\target\x86_64-pc-windows-msvc\release\bundle\nsis\*.exe -ErrorAction SilentlyContinue $fichiers += Get-ChildItem desktop\target\x86_64-pc-windows-msvc\release\bundle\msi\*.msi -ErrorAction SilentlyContinue if ($fichiers.Count -eq 0) { Write-Error "Aucun installeur trouvé dans les bundles (nsis/msi)." exit 1 } foreach ($f in $fichiers) { Write-Host "Envoi de $($f.Name) vers obsigate-desktop/$env:VER/" curl.exe -fsS -u "$($env:NEXUS_USER):$($env:NEXUS_PASSWORD)" --upload-file "$($f.FullName)" "https://nexus.dracodev.net/repository/suite-dracodev/obsigate-desktop/$env:VER/$($f.Name)" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } Write-Host "Publié : obsigate-desktop/$env:VER (Windows) dans suite-dracodev." - name: Vérifier le dépôt (retéléchargement + empreintes) env: NEXUS_USER: ${{ secrets.NEXUS_USER }} NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} run: | $fichiers = @() $fichiers += Get-ChildItem desktop\target\x86_64-pc-windows-msvc\release\bundle\nsis\*.exe -ErrorAction SilentlyContinue $fichiers += Get-ChildItem desktop\target\x86_64-pc-windows-msvc\release\bundle\msi\*.msi -ErrorAction SilentlyContinue foreach ($f in $fichiers) { $dist = Join-Path $env:RUNNER_TEMP "nexus-check-$($f.Name)" curl.exe -fsS -u "$($env:NEXUS_USER):$($env:NEXUS_PASSWORD)" -o "$dist" "https://nexus.dracodev.net/repository/suite-dracodev/obsigate-desktop/$env:VER/$($f.Name)" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } $hLocal = (Get-FileHash $f.FullName -Algorithm SHA256).Hash $hDist = (Get-FileHash $dist -Algorithm SHA256).Hash if ($hLocal -ne $hDist) { Write-Error "Dépôt Nexus non conforme pour $($f.Name) (SHA-256 différent)." exit 1 } Write-Host "Vérifié : $($f.Name) (SHA-256 identique)." }