forked from mimacom/liferay-db-setup-core
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrelease-version.bat
94 lines (74 loc) · 2.48 KB
/
release-version.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
@echo off
:: Check the input parameters
if "%~1"=="" (
call :echoUsage %0
goto :eof
)
if "%~2"=="" (
call :echoUsage %0
goto :eof
)
:: Variables
set RELEASE_VERSION=%1
set NEXT_DEV_VERSION=%2
@echo on
:: Starts the gpg-agent on Windows if not started
call gpg-connect-agent -q reloadagent /bye
if %ERRORLEVEL% NEQ 0 (EXIT /B 1)
echo gpg-agent started
:: Actualize local develop & master branches
git checkout master
if %ERRORLEVEL% NEQ 0 (EXIT /B 1)
git merge --ff-only origin/master
if %ERRORLEVEL% NEQ 0 (EXIT /B 1)
git checkout develop
if %ERRORLEVEL% NEQ 0 (EXIT /B 1)
git merge --ff-only origin/develop
if %ERRORLEVEL% NEQ 0 (EXIT /B 1)
:: Build develop
call mvn clean package
if %ERRORLEVEL% NEQ 0 (EXIT /B 1)
:: Create release branch
git branch release/%RELEASE_VERSION% develop
if %ERRORLEVEL% NEQ 0 (EXIT /B 1)
:: Maven release version
git checkout release/%RELEASE_VERSION%
call mvn versions:set -DnewVersion="%RELEASE_VERSION%" -DgenerateBackupPoms=false
if %ERRORLEVEL% NEQ 0 (EXIT /B 1)
git add "*pom.xml"
git commit -m "release/%RELEASE_VERSION% Maven project version set to %RELEASE_VERSION%"
if %ERRORLEVEL% NEQ 0 (EXIT /B 1)
:: Finish the release branch
git checkout master
git merge -m "Merge branch 'release/%RELEASE_VERSION%' into master" --no-ff release/%RELEASE_VERSION%
if %ERRORLEVEL% NEQ 0 (EXIT /B 1)
git branch -d release/%RELEASE_VERSION%
if %ERRORLEVEL% NEQ 0 (EXIT /B 1)
:: Build new production artifacts
call mvn clean deploy -P release
if %ERRORLEVEL% NEQ 0 (EXIT /B 1)
:: Tag the new relase version
git tag -m "Version %RELEASE_VERSION%" -a v%RELEASE_VERSION%
if %ERRORLEVEL% NEQ 0 (EXIT /B 1)
:: Merge master back to develop branch
git checkout develop
git merge -m "Merge branch 'master' with version '%RELEASE_VERSION%' into develop" --no-ff master
if %ERRORLEVEL% NEQ 0 (EXIT /B 1)
:: Maven next development version
call mvn versions:set -DnewVersion="%NEXT_DEV_VERSION%" -DgenerateBackupPoms=false
if %ERRORLEVEL% NEQ 0 (EXIT /B 1)
git add "*pom.xml"
git commit -m "release/%RELEASE_VERSION% Development continues on version %NEXT_DEV_VERSION%"
:: Push the changes to the 'origin' repo
git push --tags origin master develop
EXIT /B %ERRORLEVEL%
:: Functions
:echoUsage
echo Usage:
echo.
echo %~0 ^<release-version^> ^<next-dev-version^>
echo.
echo - release-version - The version which should be tagged (e.g. '1.0.0')
echo - next-dev-version - Next version which will be used for further development (e.g. '1.1.0-SNAPSHOT')
echo.
EXIT /B 0