forked from zer0Kerbal/MoarKerbals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildRelease.bat
76 lines (55 loc) · 2.15 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
75
76
@echo off
rem Put the following text into the Post-build event command line:
rem without the "rem":
rem start /D C:\KSP_DEV\Workspace\ODFCr\ /WAIT deploy.bat $(TargetDir) $(TargetFileName)
rem
rem if $(ConfigurationName) == Release start /D C:\KSP_DEV\Workspace\ODFCr\ /WAIT buildRelease.bat $(TargetDir) $(TargetFileName)
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=MoarKerbals
REM set GAMEDIR2=ExtraplanetaryLaunchpads
set GAMEDATA="GameData\"
set VERSIONFILE=%GAMEDIR%.version
set LICENSE="License.txt"
rem Set LICENSETEXT="CC-BY-NC-SA-4.0.txt"
set README="Readme.md"
set JQ=C:\ProgramData\chocolatey\lib\jq\tools\jq.exe
set RELEASEDIR=C:\KSP_DEV\Releases
set ZIP="c:\Program Files\7-zip\7z.exe"
rem Copy files to GameData locations
REM copy /Y "%1%2" "%GAMEDATA%\%GAMEDIR%\Plugins"
REM copy /Y %GAMEDIR%.version %GAMEDATA%\%GAMEDIR%
copy /Y %GAMEDIR%.version %GAMEDATA%\%GAMEDIR%
copy /Y Changelog.cfg %GAMEDATA%\%GAMEDIR%
if "%LICENSE%" NEQ "" copy /y %LICENSE% %GAMEDATA%\%GAMEDIR%
REM if "%LICENSETEXT%" NEQ "" copy /y %LICENSETEXT% %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/
%JQ% ".VERSION.MAJOR" %VERSIONFILE% >tmpfile
set /P major=<tmpfile
%JQ% ".VERSION.MINOR" %VERSIONFILE% >tmpfile
set /P minor=<tmpfile
%JQ% ".VERSION.PATCH" %VERSIONFILE% >tmpfile
set /P patch=<tmpfile
%JQ% ".VERSION.BUILD" %VERSIONFILE% >tmpfile
set /P build=<tmpfile
del tmpfile
del tmp.version
set VERSION=%major%.%minor%.%patch%.%build%
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