-
Notifications
You must be signed in to change notification settings - Fork 158
/
SemVer.groovy
46 lines (38 loc) · 1.11 KB
/
SemVer.groovy
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
def getTagversion (String oldtagVersion)
{
oldtagVersion = oldtagVersion.substring(1)
println oldtagVersion
def versionParts = oldtagVersion.tokenize('.')
println versionParts
major = versionParts[0].toInteger()
minor = versionParts[1].toInteger()
timetag = versionParts[2].toString()
this.month = timetag.substring(4,6).toInteger()
Calendar now = Calendar.getInstance();
currmonth = (now.get(Calendar.MONTH) +1)
Date date = new Date()
//println date.getTime()
//println date.format( 'yyyy-MM-ddHH:mm:ss.S' )
String newtimetag = date.format( 'yyyyMMdd-HHmm' ).toString()
//println strtimetag
//timetag= timetag.replaceAll(":","-")
if (currmonth==month)
{
version = major+ "." + minor + "." +newtimetag
}
else
{
if (month < 9)
{
minor = minor +1
version = major+ "." + minor + "." +newtimetag
}
else
{
major = this.major +1
minor = 0
version = major+ "." + minor + "." +newtimetag
}
}
return version
}