Files
Samuele Locatelli 943ef13752 - update comments on statsCollector
- update yaml robocopy html
2025-11-28 10:07:38 +01:00

262 lines
9.7 KiB
YAML

variables:
NUGET_PATH: 'C:\Tools\nuget.exe'
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
SOL_NAME: 'IOB-MAN'
APP_NAME: 'IOB-MAN'
NUM_REL: '0.1.2.3'
NUM_DEB: '0.1.2-beta.3'
CONFIG: ''
VERS_MAIN: '4.0'
NEW_REL: ''
OUTPUT_DIR: ''
NET_SHARE_X: '\\codedoc.egalware.com\library'
NET_USER_X: 'gitlab'
NEXUS_PATH: 'MAPO/IOB-MAN'
URL_VERSIONS_LOG: "https://liman.egalware.com/ELM.API/api/release/save"
CRITICAL_STRING: "#critical#"
.DocReplica: &DocReplica
- |
net use A: /delete
net use A: $env:NET_SHARE_X /u:$env:NET_USER_X $XDRIVE_PASSWD
ROBOCOPY doxygen/html A:\$env:APP_NAME /MIR /XF .git* /XD .git
SLEEP 2
net use A: /delete
# helper x fix pacchetti nuget da repo locale nexus.steamware.net
.nuget-fix: &nuget-fix
- |
echo "esecuzione Nuget FIX steps"
dotnet nuget list source
$hasSource = dotnet nuget list source | Select-String -Pattern "Steamware Nexus Proxy"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source "`"Steamware Nexus Proxy`""
}
$hasSource = dotnet nuget list source | Select-String -Pattern "Steamware Nexus"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source "`"Steamware Nexus`""
}
$hasSource = dotnet nuget list source | Select-String -Pattern "nexus-proxy-v3"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source nexus-proxy-v3
}
$hasSource = dotnet nuget list source | Select-String -Pattern "nexus-hosted"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source nexus-hosted
}
# $hasSource = dotnet nuget list source | Select-String -Pattern "Microsoft Visual Studio Offline Packages"
# if (! [String]::IsNullOrWhiteSpace($hasSource)) {
# dotnet nuget remove source 'Microsoft Visual Studio Offline Packages'
# }
echo "Situazione sorgenti post remove:"
dotnet nuget list source
dotnet nuget add source https://nexus.steamware.net/repository/nuget-proxy-v3/index.json -n nexus-proxy-v3 -u nugetUser -p $NEXUS_PASSWD --store-password-in-clear-text
dotnet nuget add source https://nexus.steamware.net/repository/nuget-hosted/ -n nexus-hosted -u nugetUser -p $NEXUS_PASSWD --store-password-in-clear-text
$hasSource = dotnet nuget list source
echo "Situazione sorgenti FINALE:"
dotnet nuget list source
# helper x fix version number
.version-fix: &version-fix
- |
$env:NEW_REL = $env:VERS_MAIN+"."+(get-date -format yyMM)+"."+(get-date -format ddHH)
$env:NUM_REL = $env:VERS_MAIN+"."+(get-date -format yyMM)+"."+(get-date -format dHH)
$env:NUM_DEB = $env:VERS_MAIN+"."+(get-date -format yyMM)+"-beta."+(get-date -format dHH)
$env:NEW_COPYRIGHT = "EgalWare @ 2006-" + (get-date -format yyyy)
# $contenuto = Get-Content -path 'VersGen\VersGen.cs' -Raw
# $newContenuto = $contenuto -replace '0.0.0.0', $env:NEW_REL
# $newContenuto = $newContenuto -replace 'EgalWare © 2006', $env:NEW_COPYRIGHT
# $newContenuto | Set-Content -Path 'VersGen\VersGen.cs'
# display versioni generate
$resoconto = "Effettuato fix Versione | release v: " + $env:NUM_REL + " | debug v: " + $env:NUM_DEB;
Write-Output $resoconto;
echo "Replace completati"
# helper x fix nuspec file
.nuspec-fix: &nuspec-fix
- |
echo "Modifica dati file nuspec Release"
$currRelease = $env:NUM_REL
$currDebug = $env:NUM_DEB
$find = "<version>(.|\n)*?</version>";
$fileNameRel = "$env:APP_NAME.Release.nuspec";
$replRel = "<version>" + $currRelease + "</version>";
$nuspDataRel = Get-Content $fileNameRel;
$nuspDataRelUpd = $nuspDataRel -replace $find, $replRel;
$nuspDataRelUpd = $nuspDataRelUpd -replace "#copyright#", $replCopy;
$nuspDataRelUpd = $nuspDataRelUpd -replace "#releaseNotes#", "Build $adesso";
Set-Content -Path $fileNameRel -Value $nuspDataRelUpd;
echo "Modifica dati file nuspec Debug"
$fileNameDeb = "$env:APP_NAME.Debug.nuspec";
$replDeb = "<version>" + $currDebug + "</version>";
$nuspDataDeb = Get-Content $fileNameDeb;
$nuspDataDebUpd = $nuspDataDeb -replace $find, $replDeb;
$nuspDataDebUpd = $nuspDataDebUpd -replace "#copyright#", $replCopy;
$nuspDataDebUpd = $nuspDataDebUpd -replace "#releaseNotes#", "Build $adesso";
Set-Content -Path $fileNameDeb -Value $nuspDataDebUpd;
echo "replace completati"
# helper pulizia files zip
.cleanup-zip: &cleanup-zip
- |
$env:OUTPUT_DIR = "Releases\" + $CI_COMMIT_BRANCH + "\*"
if ((Test-Path $env:OUTPUT_DIR))
{
Remove-Item $env:OUTPUT_DIR -Force -Recurse -ErrorAction Ignore
}
echo "Clening ZIP dir: $env:OUTPUT_DIR"
# helper creazione files zip
.zipper: &zipper
- |
$7zipPath = $env:ProgramFiles+"\7-Zip\7z.exe"
if (-not (Test-Path -Path $7zipPath -PathType Leaf)) {
throw "7 zip file '$7zipPath' not found"
}
Set-Alias 7zip $7zipPath
cd "publish\"
$Source = "*"
$Target = "..\$env:APP_NAME\Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip"
#cd "$env:APP_NAME\bin\"
7zip a -tzip $Target $Source -xr!DATA\CONF
cd "..\$env:APP_NAME\"
echo "called ZIP $Source --> $Target"
# helper creazione hash files
.hashBuild: &hashBuild
- |
$Target = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip"
$MD5 = Get-FileHash $Target -Algorithm MD5
$SHA1 = Get-FileHash $Target -Algorithm SHA1
New-Item $Target".md5"
New-Item $Target".sha1"
$MD5.Hash | Set-Content -Path $Target".md5"
$SHA1.Hash | Set-Content -Path $Target".sha1"
echo "Created HASH files for $Target"
.nexusUpload: &nexusUpload
- |
Set-Alias mCurl C:\Windows\system32\curl.exe
$VersNumb = $env:NEW_REL
echo "Curr Version: $VersNumb"
if($CI_COMMIT_BRANCH -eq "main")
{
$version = "stable"
}
else
{
$version = "unstable"
}
$File2Send = Get-ChildItem("Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".*")
ForEach ($File in $File2Send) {
$FileName = Split-Path $File -leaf
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName
}
echo "Upload area utility for Releases\$CI_COMMIT_BRANCH\$env:APP_NAME.*"
$FileUtility = Get-ChildItem("Releases\$CI_COMMIT_BRANCH\$env:APP_NAME.*")
ForEach ($File in $FileUtility) {
$FileName = Split-Path $File -leaf
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/utility/MAPO/$env:APP_NAME/$version/$FileName
}
# helper invio notifica a log versioni online (LiMan)
.SendToVersionsLog: &SendToVersionsLog
- |
echo "----------------------------------------------"
echo " Invio versione a Liman x log online"
echo "----------------------------------------------"
$tags = ""
# se critico scrive tag
if ( $CI_COMMIT_MESSAGE | Select-String -Pattern $env:CRITICAL_STRING) {
$tags = "CRITICAL"
}
$date = (Get-Date).toString("yyyy-MM-ddTHH:mm:ss.fffZ")
$body =
@{
codInst = "EgalWare"
codApp = $env:APP_NAME
uplAppId = "UpdateManager"
masterKey = $LiMan_Key
tipo = "WinApp"
versNum = $env:NEW_REL
versText = $env:NEW_REL
releaseDate = $date
relTags = $tags
}
$jsonBody = ConvertTo-Json -InputObject $body
echo $jsonBody
Invoke-WebRequest -Method Post -URI $env:URL_VERSIONS_LOG -ContentType "application/json" -Body $jsonBody -UseBasicParsing
stages:
- build
- release
- doxygen
# --------------------------------
# BUILD
# --------------------------------
IOB-MAN:build:
stage: build
tags:
- win
variables:
APP_NAME: IOB-MAN
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
script:
- echo $CI_COMMIT_BRANCH
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# --------------------------------
# RELEASE
# --------------------------------
IOB-MAN:release:
stage: release
needs: ["IOB-MAN:build"]
only:
- main
- develop
tags:
- win
variables:
APP_NAME: IOB-MAN
NEXUS_PATH: MAPO/IOB-MAN
before_script:
- *nuget-fix
- *version-fix
# - *cleanup-zip
script:
- echo $CI_COMMIT_BRANCH
- $env:DOTNET_NUGET_SIGNATURE_VERIFICATION = 'false'
- dotnet restore "$env:SOL_NAME.sln" --no-cache
# - '& "$env:MSBUILD_PATH" -t:publish -p:PublishProfile=FolderProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj'
- dotnet publish -p:PublishProfile=FolderProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish -r win-x64 --no-self-contained
- *zipper
- *hashBuild
- *nexusUpload
- *SendToVersionsLog
# --------------------------------
# doxygen
# --------------------------------
IOB-MAN:doxygen:
stage: doxygen
needs: ["IOB-MAN:build"]
tags:
- win
variables:
APP_NAME: IOB-MAN
rules:
- if: $CI_COMMIT_BRANCH == 'main'
changes:
- IOB-MAN/*
when: always
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet'
script:
- doxygen.exe Doxyfile
# - mv $env:APP_NAME/_site "doxygen"
- *DocReplica