Files
webwindowconfigurator/.gitlab-ci.yml
T
Samuele Locatelli 3adf9a3538 ancora fix move
2025-07-18 08:57:49 +02:00

302 lines
11 KiB
YAML

variables:
VERS_MAIN: '1.0'
NEXUS_PATH: 'LUX'
PROJ_PATH: ''
APP_NAME: 'Test.UI'
SOL_NAME: 'Test.UI'
NUGET_PATH: 'C:\Tools\nuget.exe'
DEST: 'install'
# nota: cer creazione rules: https://docs.gitlab.com/ee/ci/jobs/job_control.html#common-if-clauses-for-rules
# 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 appsettings config nei casi installer / office
#.appsettings-fix: &appsettings-fix
# - |
# echo "esecuzione FIX appsettings.json"
# $srcFile="$env:APP_NAME/appsettings.Production-install.json"
# $dstFile="$env:APP_NAME/appsettings.Production.json"
# if (($env:DEST -ne 'install')) {
# $srcFile="$env:APP_NAME/appsettings.Production-office.json"
# }
# echo "Copy-Item -Path $srcFile -Destination $dstFile -force"
# Copy-Item -Path $srcFile -Destination $dstFile -force
# echo "Completata copia file appsettings.json corretto"
# helper creazione hash files x IIS
.hashBuild: &hashBuild
- |
$Target = $env:APP_NAME + "\bin\publish\" + $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"
# helper x send su NEXUS x pack
.nexusUpload: &nexusUpload
- |
Set-Alias mCurl C:\Windows\system32\curl.exe
$fileVers = $env:APP_NAME + "\Resources\VersNum.txt"
$VersNumb = Get-Content $fileVers
echo "Curr Version: $VersNumb"
if($CI_COMMIT_BRANCH -eq "master")
{
$version = "stable"
}
else
{
$version = "unstable"
}
$File2Send = Get-ChildItem($env:APP_NAME + "\bin\publish\*")
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
}
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "$env:APP_NAME\Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "$env:APP_NAME\Resources\ChangeLog.html" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/ChangeLog.html
# 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)
# display versioni generate
$resoconto = "Effettuato fix file VersGen | 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 = "*.Release.nuspec";
$replRel = "<version>" + $currRelease + "</version>";
$replCopy ="Egalware 2021+";
$adesso = $env:VERS_MAIN+"."+(get-date -format yyMM)+"."+(get-date -format dHH)
$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 = "*.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"
# Stages previsti
stages:
- build
- deploy
# - installer
# - release
# --------------------------------
# BUILD
# --------------------------------
Test.UI:build:
stage: build
tags:
- win
variables:
APP_NAME: Test.UI
SOL_NAME: Test.UI
rules:
- if: $CI_COMMIT_BRANCH == 'develop'
- if: $CI_COMMIT_BRANCH == 'main'
- if: $CI_COMMIT_BRANCH =~ /^feature\/Test.UI.+/
when: always
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
script:
- echo $CI_COMMIT_BRANCH
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# --------------------------------
# DEPLOY develop (IIS01 + beta nuget)
# --------------------------------
Test.UI:IIS01:deploy:
stage: deploy
tags:
- win
variables:
APP_NAME: Test.UI
SOL_NAME: Test.UI
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
rules:
- if: $CI_COMMIT_BRANCH == 'develop'
- if: $CI_COMMIT_BRANCH =~ /^feature\/Test.UI.+/
when: always
needs: ["Test.UI:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
# Test.UI:SDK:deploy:
# stage: deploy
# tags:
# - win
# variables:
# APP_NAME: MP.AppAuth
# SOL_NAME: Test.UI
# before_script:
# - *nuget-fix
# - dotnet restore "$env:SOL_NAME.sln"
# - *version-fix
# - *nuspec-fix
# rules:
# - if: $CI_COMMIT_BRANCH == 'develop'
# - if: $CI_COMMIT_BRANCH =~ /^feature\/Test.UI.+/
# when: always
# needs: ["Test.UI:build"]
# script:
# - dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# - '& Remove-Item *.nupkg'
# - '& $env:NUGET_PATH pack "EgwProxy.MP.Core.Debug.nuspec"'
# - '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted'
# - '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
# # --------------------------------
# # DEPLOY master (IIS03/IIS04)
# # --------------------------------
# Test.UI:IIS03:deploy:
# stage: deploy
# tags:
# - win
# variables:
# APP_NAME: Test.UI
# SOL_NAME: Test.UI
# before_script:
# - *nuget-fix
# - dotnet restore "$env:SOL_NAME.sln"
# rules:
# - if: $CI_COMMIT_BRANCH == 'main'
# needs: ["Test.UI:build"]
# script:
# - dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# - dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
# - dotnet publish -p:PublishProfile=IIS04.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
# # --------------------------------
# # INSTALLER (develop/master)
# # --------------------------------
# Test.UI:installer:
# stage: installer
# tags:
# - win
# variables:
# APP_NAME: Test.UI
# SOL_NAME: Test.UI
# NEXUS_PATH: MP-LAND
# before_script:
# - *nuget-fix
# - dotnet restore "$env:SOL_NAME.sln"
# rules:
# - if: $CI_COMMIT_BRANCH == 'main'
# - if: $CI_COMMIT_BRANCH == 'develop'
# needs: ["Test.UI:build"]
# script:
# - dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish -p:verbosity=quiet
# # qui il deploy su nexus...
# - *hashBuild
# - *nexusUpload
# # --------------------------------
# # RELEASE (tags only + sdk)
# # --------------------------------
# Test.UI:release:
# stage: release
# tags:
# - win
# variables:
# APP_NAME: Test.UI
# SOL_NAME: Test.UI
# NEXUS_PATH: MP-LAND
# before_script:
# - *nuget-fix
# - dotnet restore "$env:SOL_NAME.sln"
# rules:
# - if: $CI_COMMIT_TAG
# needs: ["Test.UI:build"]
# artifacts:
# paths:
# - publish/
# script:
# - dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# - dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj -p:verbosity=quiet
# Test.UI:SDK:release:
# stage: release
# tags:
# - win
# variables:
# APP_NAME: MP.AppAuth
# SOL_NAME: Test.UI
# before_script:
# - *nuget-fix
# - dotnet restore "$env:SOL_NAME.sln"
# - *version-fix
# - *nuspec-fix
# rules:
# - if: $CI_COMMIT_BRANCH == 'main'
# needs: ["Test.UI:build"]
# script:
# - dotnet build $env:APP_NAME/$env:APP_NAME.csproj -c Release
# - '& Remove-Item *.nupkg'
# - '& $env:NUGET_PATH pack "EgwProxy.MP.Core.Release.nuspec"'
# - '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted'
# - '& "$env:NUGET_PATH" push *$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'