Files
annotations/build/zip.bat
T

105 lines
2.8 KiB
Batchfile

@echo off
setlocal enabledelayedexpansion
:: Move one level up
cd /d ..
echo [INFO] Changed working directory to: %CD%
:: Get timestamp
for /f %%a in ('powershell -NoProfile -Command "Get-Date -Format yyyyMMdd-HHmmss"') do set "timestamp=%%a"
set "fullZipCreated=0"
set "iterZipCreated=0"
:: ===== FULL BUILD =====
set "fullExe="
for %%F in (AzaionSuite.Full.*.exe) do (
set "fullExe=%%F"
goto :FullExeFound
)
echo [WARNING] No Full build EXE found [AzaionSuite.Full.*.exe]
goto :AfterFullBuild
:FullExeFound
echo [INFO] Found Full build EXE: [%fullExe%]
set "baseFull=%fullExe:.exe=%"
:: Collect BIN files for Full build
set "fullBinList="
for %%B in (%baseFull%-*.bin) do (
echo [INFO] Found BIN file: [%%B]
if defined fullBinList (
set "fullBinList=!fullBinList!,\"%%B\""
) else (
set "fullBinList=\"%%B\""
)
)
echo [INFO] BIN files list: %fullBinList%
:: Compose PowerShell command for Full
if "%fullBinList%"=="" (
set "fullPsCmd=Compress-Archive -Force -Path \"%fullExe%\" -DestinationPath \"%baseFull%-%timestamp%.zip\""
) else (
set "fullPsCmd=Compress-Archive -Force -Path \"%fullExe%\",%fullBinList% -DestinationPath \"%baseFull%-%timestamp%.zip\""
)
echo [INFO] Creating ZIP: [%baseFull%-%timestamp%.zip]
echo [INFO] Using PowerShell command to compress:
echo powershell -Command "%fullPsCmd%"
powershell -Command "%fullPsCmd%"
if errorlevel 1 (
echo [ERROR] Failed to create Full archive: [%baseFull%-%timestamp%.zip]
) else (
echo [SUCCESS] Full archive created: [%baseFull%-%timestamp%.zip]
set "fullZipCreated=1"
)
:AfterFullBuild
:: ===== ITERATIVE BUILD =====
set "iterExe="
for %%I in (AzaionSuite.Iterative.*.exe) do (
set "iterExe=%%I"
goto :IterExeFound
)
echo [WARNING] No Iterative build EXE found [AzaionSuite.Iterative.*.exe]
goto :AfterIterBuild
:IterExeFound
echo [INFO] Found Iterative build EXE: [%iterExe%]
set "baseIter=%iterExe:.exe=%"
:: Iterative pack (exe only)
set "iterPsCmd=Compress-Archive -Force -Path \"%iterExe%\" -DestinationPath \"%baseIter%-%timestamp%.zip\""
echo [INFO] Creating ZIP: [%baseIter%-%timestamp%.zip]
echo [INFO] Using PowerShell command to compress:
echo powershell -Command "%iterPsCmd%"
powershell -Command "%iterPsCmd%"
if errorlevel 1 (
echo [ERROR] Failed to create Iterative archive: [%baseIter%-%timestamp%.zip]
) else (
echo [SUCCESS] Iterative archive created: [%baseIter%-%timestamp%.zip]
set "iterZipCreated=1"
)
:AfterIterBuild
echo.
if "%fullZipCreated%"=="1" (
if "%iterZipCreated%"=="1" (
echo [DONE] Both Full and Iterative packaging complete.
) else (
echo [DONE] Full packaging complete. No Iterative package created.
)
) else (
if "%iterZipCreated%"=="1" (
echo [DONE] Iterative packaging complete. No Full package created.
) else (
echo [INFO] No packages were created.
)
)