1
0

verify-package.bat 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. @echo off
  2. setlocal ENABLEEXTENSIONS
  3. echo [INFO] Verify WaouW package
  4. REM 1) docker compose syntax
  5. docker compose -f DEPLOY\docker-compose.yml config >nul 2>&1
  6. if errorlevel 1 (
  7. echo [ERR] docker-compose.yml invalid (docker compose config failed)
  8. exit /b 1
  9. ) else (
  10. echo [OK] compose syntax
  11. )
  12. REM 2) Frontend markers in compose
  13. findstr /I /C:"VITE_API_URL" /C:"condition: service_healthy" /C:"healthcheck:" DEPLOY\docker-compose.yml >nul
  14. if errorlevel 1 (
  15. echo [ERR] Missing frontend markers (VITE_API_URL / depends_on healthy / healthcheck)
  16. exit /b 1
  17. ) else (
  18. echo [OK] compose frontend markers
  19. )
  20. REM 3) Check deploy zip exists
  21. if not exist DEPLOY\waouw-deploy.zip (
  22. echo [ERR] DEPLOY\waouw-deploy.zip not found
  23. exit /b 1
  24. )
  25. REM 4) Inside deploy zip: version.ver and v-*.ver present
  26. powershell -NoProfile -Command ^
  27. "$p='DEPLOY\waouw-deploy.zip';" ^
  28. "$z=[IO.Compression.ZipFile]::OpenRead((Resolve-Path $p));" ^
  29. "$names=$z.Entries.Name;" ^
  30. "$has1=$names -contains 'version.ver';" ^
  31. "$has2=$names -match '^v-\d+-\d+-\d+\.ver$';" ^
  32. "$z.Dispose();" ^
  33. "if(-not $has1 -or -not $has2){ exit 2 }"
  34. if errorlevel 2 (
  35. echo [ERR] version.ver and/or v-*-*.ver missing in deploy zip
  36. exit /b 1
  37. ) else (
  38. echo [OK] deploy zip version files
  39. )
  40. REM 5) Latest sources zip must NOT contain 'Versions/' folder
  41. for /f "usebackq delims=" %%Z in (`powershell -NoProfile -Command ^
  42. "$z=(Get-ChildItem -Path 'Versions' -Filter '*-src.zip' -EA SilentlyContinue | Sort-Object LastWriteTime -Desc | Select-Object -First 1); if($z){ $z.FullName }"`) do set SRCZIP=%%Z
  43. if "%SRCZIP%"=="" (
  44. echo [WARN] No sources zip found in Versions\ (skip check)
  45. ) else (
  46. powershell -NoProfile -Command ^
  47. "$p='%SRCZIP%'; $z=[IO.Compression.ZipFile]::OpenRead((Resolve-Path $p));" ^
  48. "$bad=$false; foreach($e in $z.Entries){ if($e.FullName -match '^Versions/'){ $bad=$true; break } }" ^
  49. "$z.Dispose();" ^
  50. "if($bad){ exit 3 }"
  51. if errorlevel 3 (
  52. echo [ERR] Sources zip contains 'Versions/' (should be excluded)
  53. exit /b 1
  54. ) else (
  55. echo [OK] sources zip excludes 'Versions/'
  56. )
  57. )
  58. echo [OK] All checks passed
  59. endlocal
  60. exit /b 0