:: copy thirdparty
xcopy %project_path%\thirdparty\dlls\win32\Release %project_path%\bin\win32\Release /y /i

:: compile
devenv "%project_path%\VVLive/VVLive.sln" /build "Release|x86" /project "VVLive\VVLive.vcxproj" /projectconfig "Release|Win32"
if NOT %errorlevel% equ 0 (
    echo [ERROR] Failed to devenv build
    exit /b 1
)

:: generate qt.bat
node %project_path%\tools_release\release.js %publish_folder_path%

:: run qt.bat
cd /d %publish_folder_path%
if NOT exist qt.bat (
    echo [ERROR] qt.bat not exist
    exit /b 1	
)
call qt.bat
if NOT %errorlevel% equ 0 (
    echo [ERROR] Failed to run qt.bat
    exit /b 1
)
cd /d %publish_folder_path%
del qt.bat

:: tag version
cd /d %project_path%
git commit -m "[release]:%pc_full_version%"
set tag_name="KeLeAnchor/%pc_full_version%"
git tag %tag_name%
git push origin %tag_name%