Repository navigation
Expand file tree
/
Copy pathbuild.bat
More file actions
87 lines (69 loc) · 2.13 KB
/
Copy pathbuild.bat
File metadata and controls
87 lines (69 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
@echo off
if exist "Release" (
rmdir /s /q "Release"
)
mkdir "Release"
cd DotBot
echo.
echo =====================================
echo Extracting version number...
echo =====================================
echo.
REM Set default version in case extraction fails
set VERSION=0.0.0
REM Extract version using PowerShell for better reliability
for /f "delims=" %%i in ('powershell -Command "(Select-Xml -Path 'DotBot.csproj' -XPath '//Version').Node.InnerText"') do set VERSION=%%i
REM If PowerShell method failed, try manual parsing
if "%VERSION%"=="0.0.0" (
echo Trying alternative version extraction method...
for /f "tokens=2 delims=>" %%a in ('findstr /C:"<Version>" DotBot.csproj 2^>nul') do (
for /f "tokens=1 delims=<" %%b in ("%%a") do set VERSION=%%b
)
)
REM Remove any whitespace
for /f "tokens=* delims= " %%a in ("%VERSION%") do set VERSION=%%a
echo Version found: %VERSION%
echo.
echo =====================================
echo Building DotBot...
echo =====================================
echo.
call dotnet publish /p:PublishProfile=ReleaseProfile
if %ERRORLEVEL% neq 0 (
echo Build DotBot failed with exit code %ERRORLEVEL%.
goto :failure
)
goto :success
:failure
echo.
echo Installation failed. Please try again.
echo.
pause
exit /b 1
:success
echo.
echo =====================================
echo Build completed successfully!
echo =====================================
echo.
cd ..
echo.
echo =====================================
echo Packaging...
echo =====================================
echo.
REM Copy helper scripts to CLI output directory
copy /Y "Scripts\install_to_path.ps1" "Release\DotBot\install_to_path.ps1"
copy /Y "Scripts\dotbot.bat" "Release\DotBot\dotbot.bat"
copy /Y "Scripts\dotbot.ps1" "Release\DotBot\dotbot.ps1"
REM Create zip for DotBot
echo Creating DotBot.zip...
powershell -Command "Compress-Archive -Path 'Release\DotBot\*' -DestinationPath 'Release\DotBot_v%VERSION%.zip' -Force"
echo.
echo =====================================
echo Packaging completed!
echo =====================================
echo - DotBot.zip created
echo =====================================
echo.
pause