Files
lux/.gitlab-ci.yml
Samuele Locatelli addc59e40b Fix vers number x SDK
2025-10-20 14:47:31 +02:00

403 lines
14 KiB
YAML

variables:
VERS_MAIN: '1.0'
NEW_REL: ''
NUM_REL: '0.1.2.3'
NUM_DEB: '0.1.2-beta.3'
NU_TYPE: 'Debug'
NEXUS_PATH: 'LUX'
PROJ_PATH: ''
APP_NAME: 'Lux.UI'
SOL_NAME: 'Lux.All'
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)
$env:NEW_COPYRIGHT = "EgalWare @ 2021-" + (get-date -format yyyy)
# display versioni generate
$resoconto = "Effettuato calcolo versioni | release v: " + $env:NUM_REL + " | debug v: " + $env:NUM_DEB;
Write-Output $resoconto;
echo "VersionFix done"
# helper x fix nuspec file
.nuspec-fix: &nuspec-fix
- |
echo "Modifica dati generazione pacchetto nuget"
if ($env:NU_TYPE -eq "Debug")
{
$currRelease = $env:NUM_DEB
}
elseif($env:NU_TYPE -eq "Release")
{
$currRelease = $env:NUM_REL
}
echo "Versione prevista: $currRelease"
$currDebug = $env:NUM_DEB
$currCopy = $env:NEW_COPYRIGHT
$fileNameRel = "$env:APP_NAME/$env:APP_NAME.csproj";
$nuspDataRel = Get-Content $fileNameRel;
$findVers = "<Version>(.|\n)*?</Version>";
$replVers = "<Version>" + $currRelease + "</Version>";
$nuspDataRelUpd = $nuspDataRel -replace $findVers, $replVers;
$findCopy = "<copyright>(.|\n)*?</copyright>";
$replCopy = "<copyright>" + $currCopy + "</copyright>";
$nuspDataRelUpd = $nuspDataRelUpd -replace $findCopy, $replCopy;
$findRel = "<releaseNotes>(.|\n)*?</releaseNotes>";
$replRel = "<releaseNotes>Build " + $currRelease + "</releaseNotes>";
$nuspDataRelUpd = $nuspDataRelUpd -replace $findRel, $replRel;
Set-Content -Path $fileNameRel -Value $nuspDataRelUpd;
echo "Modifica dati file progetto x nuspec completata su file $fileNameRel"
# Stages previsti
stages:
- build
- deploy
#- installer
- release
# --------------------------------
# BUILD
# --------------------------------
Lux.UI:build:
stage: build
tags:
- win
variables:
APP_NAME: Lux.UI
SOL_NAME: Lux.All
rules:
- if: $CI_COMMIT_BRANCH == 'develop'
- if: $CI_COMMIT_BRANCH == 'main'
- if: $CI_COMMIT_BRANCH =~ /^feature\/Lux.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
Lux.API:build:
stage: build
tags:
- win
variables:
APP_NAME: Lux.API
SOL_NAME: Lux.All
rules:
- if: $CI_COMMIT_BRANCH == 'develop'
- if: $CI_COMMIT_BRANCH == 'main'
- if: $CI_COMMIT_BRANCH =~ /^feature\/Lux.API.+/
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)
# --------------------------------
Lux.UI:IIS01:deploy:
stage: deploy
tags:
- win
variables:
APP_NAME: Lux.UI
SOL_NAME: Lux.All
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
rules:
- if: $CI_COMMIT_BRANCH == 'develop'
- if: $CI_COMMIT_BRANCH =~ /^feature\/Lux.UI.+/
when: always
needs: ["Lux.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
Lux.API:IIS01:deploy:
stage: deploy
tags:
- win
variables:
APP_NAME: Lux.API
SOL_NAME: Lux.All
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
rules:
- if: $CI_COMMIT_BRANCH == 'develop'
- if: $CI_COMMIT_BRANCH =~ /^feature\/Lux.API.+/
when: always
needs: ["Lux.API: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
EgwCoreLib.Lux.Core:SDK:deploy:
stage: deploy
tags:
- win
variables:
APP_NAME: EgwCoreLib.Lux.Core
SOL_NAME: Lux.All
rules:
- if: $CI_COMMIT_BRANCH == 'develop'
- if: $CI_COMMIT_BRANCH =~ /^feature\/EgwCoreLib.Lux.Core.+/
when: always
needs: ["Lux.UI:build"]
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
- *version-fix
- *nuspec-fix
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet pack -p:Configuration=Debug -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push $env:APP_NAME/bin/Debug/$env:APP_NAME.$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
EgwCoreLib.Lux.Data:SDK:deploy:
stage: deploy
tags:
- win
variables:
APP_NAME: EgwCoreLib.Lux.Data
SOL_NAME: Lux.All
rules:
- if: $CI_COMMIT_BRANCH == 'develop'
- if: $CI_COMMIT_BRANCH =~ /^feature\/EgwCoreLib.Lux.Data.+/
when: always
needs: ["Lux.UI:build"]
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
- *version-fix
- *nuspec-fix
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet pack -p:Configuration=Debug -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push $env:APP_NAME/bin/Debug/$env:APP_NAME.$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
# --------------------------------
# INSTALLER (develop/master)
# --------------------------------
# Lux.UI:installer:
# stage: installer
# tags:
# - win
# variables:
# APP_NAME: Lux.UI
# SOL_NAME: Lux.All
# 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: ["Lux.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
# Lux.API:installer:
# stage: installer
# tags:
# - win
# variables:
# APP_NAME: Lux.API
# SOL_NAME: Lux.All
# NEXUS_PATH: MP-PROG
# before_script:
# - *nuget-fix
# - dotnet restore "$env:SOL_NAME.sln"
# rules:
# - if: $CI_COMMIT_BRANCH == 'main'
# - if: $CI_COMMIT_BRANCH == 'develop'
# needs: ["Lux.API: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)
# --------------------------------
Lux.UI:IIS04:release:
stage: release
tags:
- win
variables:
APP_NAME: Lux.UI
SOL_NAME: Lux.All
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
rules:
- if: $CI_COMMIT_BRANCH == 'main'
needs: ["Lux.UI:build"]
script:
- dotnet build $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
Lux.API:IIS04:release:
stage: release
tags:
- win
variables:
APP_NAME: Lux.API
SOL_NAME: Lux.All
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
rules:
- if: $CI_COMMIT_BRANCH == 'main'
needs: ["Lux.API:build"]
script:
- dotnet build $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
EgwCoreLib.Lux.Core:SDK:release:
stage: release
tags:
- win
variables:
APP_NAME: EgwCoreLib.Lux.Core
SOL_NAME: Lux.All
NU_TYPE: Release
rules:
- if: $CI_COMMIT_BRANCH == 'main'
needs: ["Lux.UI:build"]
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
- *version-fix
- *nuspec-fix
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet pack -p:Configuration=Release -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push $env:APP_NAME/bin/Release/$env:APP_NAME.$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
EgwCoreLib.Lux.Data:SDK:release:
stage: release
tags:
- win
variables:
APP_NAME: EgwCoreLib.Lux.Data
SOL_NAME: Lux.All
NU_TYPE: Release
rules:
- if: $CI_COMMIT_BRANCH == 'main'
needs: ["Lux.UI:build"]
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
- *version-fix
- *nuspec-fix
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet pack -p:Configuration=Release -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
- '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push $env:APP_NAME/bin/Release/$env:APP_NAME.$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'