Files
EgtPHOTOLib/.gitlab-ci.yml
2022-06-22 18:44:18 +02:00

156 lines
5.4 KiB
YAML

variables:
NUGET_PATH: 'C:\Tools\nuget.exe'
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
APP_NAME: 'EgtPHOTOLib'
NUM_REL: '0.1.2.3'
NUM_DEB: '0.1.2-beta.3'
CONFIG: ''
NET_SHARE_R: '\\10.74.82.201\Artifacts\EGT_SRV\EgtTech'
NET_USER: 'steamw\steamware'
NET_SHARE_X: '\\codedoc.egalware.com\library'
NET_USER_X: 'gitlab'
.DocReplica: &DocReplica
- |
net use X: /delete
net use X: $env:NET_SHARE_X /u:$env:NET_USER_X $XDRIVE_PASSWD
ROBOCOPY docfx X:\$env:APP_NAME /MIR /XF .git* /XD .git
SLEEP 2
net use X: /delete
# helper x fix pacchetti nuget da repo locale nexus.steamware.net
.nuget-fix: &nuget-fix
- |
Set-Alias nuget C:\Tools\nuget.exe
$hasSource = nuget sources list | find "`"Steamware Nexus`"" /C
if ($hasSource -eq 0) {
nuget sources Add -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
} else {
nuget sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
}
echo $hasSource
# helper copia SORGENTI DLL dalla cartella di rete R:\ alla cartella c:\EgtProg locale
.CodeReplicaR: &CodeReplicaR
- |
net use R: /delete
net use R: $env:NET_SHARE_R /u:$env:NET_USER $RDRIVE_PASSWD
ROBOCOPY R:\EgtProg\Dll32 C:\EgtProg\Dll32 /MIR
ROBOCOPY R:\EgtProg\Dll64 C:\EgtProg\Dll32 /MIR
ROBOCOPY R:\EgtProg\DllD32 C:\EgtProg\Dll32 /MIR
ROBOCOPY R:\EgtProg\DllD64 C:\EgtProg\Dll32 /MIR
SLEEP 2
net use R: /delete
# helper x recupero version number x pack
.version-fix: &version-fix
- |
# Esecuzione fix numero versione x pack nuget
$fileNameAss = ".\My Project\AssemblyInfo.vb";
$find = "^<Assembly: AssemblyVersion((.|\n)*?)>";
$riga = Select-String $fileNameAss -Pattern $find;
#Write-Output $riga
# recupero il valore della versione release/debug
$idxVers = $riga.ToString().IndexOf("AssemblyVersion(");
$currRelease = $riga.ToString().Substring($idxVers).Replace("AssemblyVersion(","").Replace(")>","").Replace("""","");
$lastDot = $currRelease.LastIndexOf(".");
$currDebug = $currRelease.Substring(0, $lastDot)+"-beta"+$currRelease.Substring($lastDot);
$env:NUM_REL = $currRelease;
$env:NUM_DEB = $currDebug;
# effettua modifica file nuspec debug/release
$find = "<version>(.|\n)*?</version>";
$fileNameDeb = "Develop.nuspec";
$replDeb = "<version>" + $currDebug + "</version>";
$nuspDataDeb = Get-Content $fileNameDeb;
$nuspDataDebUpd = $nuspDataDeb -replace $find, $replDeb;
Set-Content -Path $fileNameDeb -Value $nuspDataDebUpd;
$fileNameRel = "Release.nuspec";
$replRel = "<version>" + $currRelease + "</version>";
$nuspDataRel = Get-Content $fileNameRel;
$nuspDataRelUpd = $nuspDataRel -replace $find, $replRel;
Set-Content -Path $fileNameRel -Value $nuspDataRelUpd;
# display versioni generate
$resoconto = "Effettuato fix file nuspec | release v: " + $currRelease + " | debug v: " + $currDebug;
Write-Output $resoconto;
stages:
- build
- staging
- release
- docfx
EgtPHOTOLib:build:
stage: build
tags:
- win
variables:
CONFIG: Release
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet'
- *version-fix
- *CodeReplicaR
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME.vbproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
EgtPHOTOLib:staging:
stage: staging
needs: ["EgtPHOTOLib:build"]
tags:
- win
variables:
CONFIG: Debug
except:
refs:
- main
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet'
- *version-fix
- *CodeReplicaR
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME.vbproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
- '& "$env:NUGET_PATH" pack Develop.nuspec'
- '& "$env:NUGET_PATH" setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
EgtPHOTOLib:release:
stage: release
needs: ["EgtPHOTOLib:build"]
tags:
- win
variables:
CONFIG: Release
only:
refs:
- main
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln"-verbosity quiet'
- *version-fix
- *CodeReplicaR
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME.vbproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
- '& "$env:NUGET_PATH" pack Release.nuspec'
- '& "$env:NUGET_PATH" setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push *$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
EgtPHOTOLib:docfx:
stage: docfx
tags:
- win
script:
- docfx docfx.json
- mv _site "docfx"
- *DocReplica
only:
- main
- master
needs: ["EgtPHOTOLib:build"]