calcolo versione numerica

This commit is contained in:
luca.mazzoleni
2024-09-18 10:52:25 +02:00
parent f4b48913c5
commit 2fbbf4ca96
+55 -3
View File
@@ -131,12 +131,64 @@ variables:
echo "-----------------------"
echo " Calcolo versione"
echo "-----------------------"
# calcolo versione formato stringa
$fPath = "$env:MACH_NAME.mlde";
$vLine = Select-String -path $fPath -Pattern 'PP_VER';
$comp = $vLine -split "=";
$env:MACH_VERS = $comp[1].Replace("'","").Trim()
# display versione
Write-Output $env:MACH_VERS;
# display versione formato stringa
Write-Output $env:MACH_VERS
# calcolo versione formato numerico
$versionMonthTxt = $env:MACH_VERS.Substring(3,1)
# calcolo mese formato numerico
$versionMonthNum = 999
if ( $versionMonthTxt -eq "a") {
# gennaio
$versionMonthNum = 1
}elseif ( $versionMonthTxt -eq "b") {
# febbraio
$versionMonthNum = 2
}elseif ( $versionMonthTxt -eq "c") {
# marzo
$versionMonthNum = 3
}elseif ( $versionMonthTxt -eq "d") {
# aprile
$versionMonthNum = 4
}elseif ( $versionMonthTxt -eq "e") {
# maggio
$versionMonthNum = 5
}elseif ( $versionMonthTxt -eq "f") {
# giugno
$versionMonthNum = 6
}elseif ( $versionMonthTxt -eq "g") {
# luglio
$versionMonthNum = 7
}elseif ( $versionMonthTxt -eq "h") {
# agosto
$versionMonthNum = 8
}elseif ( $versionMonthTxt -eq "i") {
# settembre
$versionMonthNum = 9
}elseif ( $versionMonthTxt -eq "j") {
# ottobre
$versionMonthNum = 10
}elseif ( $versionMonthTxt -eq "k") {
# novembre
$versionMonthNum = 11
}elseif ( $versionMonthTxt -eq "l") {
# dicembre
$versionMonthNum = 12
}
$versionNum1 = env:MACH_VERS.Substring(0,1)
$versionNum2 = env:MACH_VERS.Substring(1,1)
$versionNum3 = $versionMonthNum
$versionNum4 = env:MACH_VERS.Substring(3,3)
env:MACH_VERS_NUM = $versionNum1 + "." + $versionNum2 + "." + $versionNum3 + "." + $versionNum4
# display versione formato numerico
Write-Output $env:MACH_VERS_NUM
# helper calcolo versione se develop
.version-fix_DEV: &version-fix_DEV
@@ -148,7 +200,7 @@ variables:
$commitAuthor = $commitAuthor[0].Trim()
$env:MACH_VERS = $commitAuthor
# display versione
Write-Output $env:MACH_VERS;
Write-Output $env:MACH_VERS
# helper creazione folders
.folder-fix: &folder-fix