forked from Aelfhe1m/KerbinSpaceStation
-
Notifications
You must be signed in to change notification settings - Fork 8
/
buildRelease.bat
74 lines (53 loc) · 1.99 KB
/
buildRelease.bat
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
@echo off
rem Put the following text into the Post-build event command line:
rem without the "rem":
rem start /D D:\Users\jbb\github\IFI-Life-Support /WAIT deploy.bat $(TargetDir) $(TargetFileName)
rem
rem if $(ConfigurationName) == Release (
rem
rem start /D D:\Users\jbb\github\IFI-Life-Support /WAIT buildRelease.bat $(TargetDir) $(TargetFileName)
rem
rem )
rem Set variables here
rem H is the destination game folder
rem GAMEDIR is the name of the mod folder (usually the mod name)
rem GAMEDATA is the name of the local GameData
rem VERSIONFILE is the name of the version file, usually the same as GAMEDATA,
rem but not always
rem LICENSE is the license file
rem README is the readme file
set GAMEDIR=xxxxx
set GAMEDATA="GameData\"
set VERSIONFILE=%GAMEDIR%.version
set LICENSE=License.txt
set README=ReadMe.md
set RELEASEDIR=d:\Users\jbb\release
set ZIP="c:\Program Files\7-zip\7z.exe"
rem Copy files to GameData locations
copy /Y "%1%2" "%GAMEDATA%\%GAMEDIR%\Plugins"
copy /Y %VERSIONFILE% %GAMEDATA%\%GAMEDIR%
if "%LICENSE%" NEQ "" copy /y %LICENSE% %GAMEDATA%\%GAMEDIR%
if "%README%" NEQ "" copy /Y %README% %GAMEDATA%\%GAMEDIR%
rem Get Version info
copy %VERSIONFILE% tmp.version
set VERSIONFILE=tmp.version
rem The following requires the JQ program, available here: https://stedolan.github.io/jq/download/
c:\local\jq-win64 ".VERSION.MAJOR" %VERSIONFILE% >tmpfile
set /P major=<tmpfile
c:\local\jq-win64 ".VERSION.MINOR" %VERSIONFILE% >tmpfile
set /P minor=<tmpfile
c:\local\jq-win64 ".VERSION.PATCH" %VERSIONFILE% >tmpfile
set /P patch=<tmpfile
c:\local\jq-win64 ".VERSION.BUILD" %VERSIONFILE% >tmpfile
set /P build=<tmpfile
del tmpfile
del tmp.version
set VERSION=%major%.%minor%.%patch%
if "%build%" NEQ "0" set VERSION=%VERSION%.%build%
echo Version: %VERSION%
rem Build the zip FILE
cd %GAMEDATA%\..
set FILE="%RELEASEDIR%\%GAMEDIR%-%VERSION%.zip"
IF EXIST %FILE% del /F %FILE%
%ZIP% a -tzip %FILE% GameData
pause