120 lines
4.4 KiB
Markdown
120 lines
4.4 KiB
Markdown
# Build Windows One-Click
|
|
|
|
Le packaging Windows standard du projet repose sur :
|
|
|
|
- `build_windows_oneclick.bat`
|
|
- `build_windows_installer_oneclick.bat`
|
|
- `scripts/build_windows_oneclick.ps1`
|
|
- `anonymisation_onefile.spec`
|
|
- `installer/Anonymisation.iss`
|
|
|
|
## Usage
|
|
|
|
Sur la machine Windows de build :
|
|
|
|
1. ouvrir le dossier du projet
|
|
2. double-cliquer sur `build_windows_oneclick.bat`
|
|
|
|
Le script :
|
|
|
|
- crée un venv de build local `.venv_build_win`
|
|
- installe les dépendances nécessaires au packaging
|
|
- génère `build_info.py`
|
|
- lance `PyInstaller` avec `anonymisation_onefile.spec`
|
|
- vérifie la présence de l'exécutable final
|
|
- prépare un dossier de livraison et une archive ZIP
|
|
- crée `release\Anonymisation-Setup.exe` si Inno Setup 6 est installé
|
|
|
|
## Sorties attendues
|
|
|
|
- exécutable : `dist\Anonymisation.exe`
|
|
- dossier de livraison : `release\Anonymisation-Windows\`
|
|
- archive : `release\Anonymisation-Windows.zip`
|
|
- installateur : `release\Anonymisation-Setup.exe`
|
|
- hash : `release\Anonymisation.exe.sha256.txt`
|
|
|
|
## Installateur Windows
|
|
|
|
L'installateur est généré avec Inno Setup 6. Il fournit :
|
|
|
|
- choix du dossier d'installation
|
|
- installation utilisateur par défaut sans droits administrateur
|
|
- raccourci menu Démarrer
|
|
- option d'icône sur le bureau
|
|
- désinstallation Windows standard
|
|
|
|
Si Inno Setup n'est pas présent sur la machine de build, le script conserve le
|
|
build EXE/ZIP et affiche un avertissement. Installer Inno Setup 6 depuis le site
|
|
officiel puis relancer le build.
|
|
|
|
Installation automatisée de la dépendance de build Inno Setup :
|
|
|
|
```powershell
|
|
powershell -ExecutionPolicy Bypass -File .\scripts\install_inno_setup_build_dep.ps1
|
|
```
|
|
|
|
Recompiler uniquement l'installateur à partir de `release\Anonymisation-Windows\Anonymisation.exe` :
|
|
|
|
```powershell
|
|
powershell -ExecutionPolicy Bypass -File .\scripts\build_windows_installer_only.ps1
|
|
```
|
|
|
|
Pour ne générer que l'exécutable et le ZIP :
|
|
|
|
```powershell
|
|
powershell -ExecutionPolicy Bypass -File .\scripts\build_windows_oneclick.ps1 -SkipInstaller
|
|
```
|
|
|
|
## Important
|
|
|
|
- les utilisateurs finaux n'ont pas besoin d'installer Python
|
|
- le build doit être lancé depuis Windows
|
|
- le modèle ONNX embarqué requis doit exister localement dans :
|
|
`models\camembert-bio-deid\onnx\model.onnx`
|
|
|
|
## Blocage Windows / SmartScreen
|
|
|
|
Un exécutable PyInstaller non signé peut déclencher Microsoft Defender SmartScreen, surtout s'il est téléchargé depuis Internet ou envoyé par e-mail. La signature réduit fortement le risque et évite l'éditeur inconnu, mais elle ne garantit pas toujours l'absence totale d'avertissement SmartScreen pour une toute nouvelle version : Windows tient aussi compte de la réputation du fichier et de son hash.
|
|
|
|
Pour une diffusion à des utilisateurs novices, la voie recommandée est :
|
|
|
|
- signer `Anonymisation.exe` avec un certificat Authenticode
|
|
- horodater la signature
|
|
- diffuser par partage réseau interne, Intune, GPO ou portail établissement
|
|
- conserver le hash `release\Anonymisation.exe.sha256.txt`
|
|
- éviter de demander aux utilisateurs de cliquer sur `Exécuter quand même`
|
|
|
|
Le script prend en charge la signature si un certificat est disponible.
|
|
|
|
### Signature automatique avec configuration locale
|
|
|
|
Sur la machine Windows de build :
|
|
|
|
1. copier `build_signing.example.ps1` en `build_signing.local.ps1`
|
|
2. renseigner l'empreinte du certificat ou le chemin du PFX
|
|
3. double-cliquer comme d'habitude sur `build_windows_oneclick.bat`
|
|
|
|
`build_signing.local.ps1` est ignoré par Git pour éviter de versionner des secrets.
|
|
|
|
### Signature manuelle via PowerShell
|
|
|
|
Avec un certificat installé dans le magasin Windows :
|
|
|
|
```powershell
|
|
powershell -ExecutionPolicy Bypass -File .\scripts\build_windows_oneclick.ps1 -Sign -CertThumbprint "EMPREINTE_CERTIFICAT"
|
|
```
|
|
|
|
Avec un fichier PFX :
|
|
|
|
```powershell
|
|
powershell -ExecutionPolicy Bypass -File .\scripts\build_windows_oneclick.ps1 -Sign -PfxPath "C:\chemin\certificat.pfx" -PfxPassword "mot-de-passe"
|
|
```
|
|
|
|
Si aucun certificat n'est disponible, le build reste possible, mais Windows peut afficher un avertissement de réputation au premier lancement.
|
|
|
|
Références Microsoft :
|
|
|
|
- SmartScreen reputation : https://learn.microsoft.com/en-us/windows/apps/package-and-deploy/smartscreen-reputation
|
|
- SignTool : https://learn.microsoft.com/en-us/windows/win32/seccrypto/signtool
|
|
- Authenticode timestamping : https://learn.microsoft.com/en-us/windows/win32/seccrypto/time-stamping-authenticode-signatures
|