Merge pull request 'CI publish-nexus : job Windows NSIS + MSI (phase 4b)' (#78) from ci-job-windows into main
This commit was merged in pull request #78.
This commit is contained in:
@@ -9,11 +9,11 @@ name: publish-nexus
|
|||||||
# → publish-nexus → Run workflow) pour (re)publier la version
|
# → publish-nexus → Run workflow) pour (re)publier la version
|
||||||
# courante.
|
# courante.
|
||||||
#
|
#
|
||||||
# Phase 4a de l'automatisation Nexus. Le pendant Windows (MSI)
|
# Phases 4a (Linux, runner ubuntu-latest) et 4b (Windows, runner
|
||||||
# reste manuel tant qu'aucun runner Windows n'est enregistré
|
# laptop-win étiqueté windows-latest) de l'automatisation Nexus.
|
||||||
# (phase 4b) ; le workflow desktop-build.yml existant, qui vise des
|
# Le workflow desktop-build.yml existant, qui vise des runners
|
||||||
# runners [self-hosted, linux/windows, desktop] inexistants, n'est
|
# [self-hosted, linux/windows, desktop] inexistants, n'est pas
|
||||||
# pas modifié.
|
# modifié.
|
||||||
#
|
#
|
||||||
# Aucun secret nouveau : NEXUS_USER / NEXUS_PASSWORD existent déjà
|
# Aucun secret nouveau : NEXUS_USER / NEXUS_PASSWORD existent déjà
|
||||||
# au niveau de l'organisation Projets (phase 1). La clé updater
|
# au niveau de l'organisation Projets (phase 1). La clé updater
|
||||||
@@ -158,3 +158,137 @@ jobs:
|
|||||||
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"
|
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; }
|
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)."
|
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)."
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user