Files
SteamWare/.gitlab-ci.yml
2025-09-17 15:20:32 +02:00

500 lines
18 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'
SOL_NAME: 'SteamWare'
APP_NAME: 'SteamWare'
NUM_PACK: '0.0.0.0'
NUM_REL: '0.1.2.3'
NUM_DEB: '0.1.2-beta.3'
CONFIG: ''
VERS_MAIN: '5.4'
NEW_COPYRIGHT: 'Egalware @'
NET_SHARE_X: '\\codedoc.egalware.com\library'
NET_USER_X: 'gitlab'
NU_TYPE: 'Release'
.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 x recupero version number x pack
.version-fix: &version-fix
- |
# Esecuzione fix numero versione x pack nuget
$fileNameAss = 'SteamWare\SteamWare.cs';
$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 $fileNameAss -Raw
$newContenuto = $contenuto -replace '0.0.0.0', $env:NUM_REL
$newContenuto = $newContenuto -replace 'EgalWare © 2006', $env:NEW_COPYRIGHT
$newContenuto | Set-Content -Path $fileNameAss
# display versioni generate
$resoconto = "Effettuato fix file nuspec | release v: " + $env:NUM_REL + " | debug v: " + $env:NUM_DEB;
# sistemo anche versioni in file nuspec
Write-Output $resoconto;
# helper x fix nuspec file: se debug aggiunge -beta nel blocco 3 del SemVer
.nuspec-fix: &nuspec-fix
- |
echo "Modifica dati versione pacchetto nuspec"
$fileNameRel = "$env:APP_NAME/$env:APP_NAME.nuspec";
$fileContent = Get-Content $fileNameRel -Raw;
$pattern = '(?i)<version>\s*(.*?)\s*</version>'
$vers = if ($fileContent -match $pattern) { $matches[1] } else { $null }
echo "Versione corrente: $vers | NugetType: $env:NU_TYPE"
if ($env:NU_TYPE -eq "Debug")
{
# $env:NUM_PACK = $vers -replace '^(\d+)\.(\d+)\.(\d+)\.(\d+)$', '$1.$2.$3-beta.$4'
$env:NUM_PACK = $env:NUM_DEB
}
elseif($env:NU_TYPE -eq "Release")
{
$env:NUM_PACK = $env:NUM_REL
}
echo "Versione calcolata: $env:NUM_PACK"
$findVers = "<version>(.|\n)*?</version>";
$replVers = "<version>" + $env:NUM_PACK + "</version>";
$newContent = $fileContent -replace $findVers, $replVers;
Set-Content -Path $fileNameRel -Value $newContent;
echo "Modifica dati file progetto x nuspec completata su file $fileNameRel"
echo "-----------------------------"
echo "$newContent"
echo "-----------------------------"
stages:
- build
- staging
- release
- docfx
# --------------------------------
# BUILD
# --------------------------------
SteamWare.IO:build:
stage: build
tags:
- win
variables:
CONFIG: Release
APP_NAME: SteamWare.IO
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln"-verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
SteamWare.Logger:build:
stage: build
tags:
- win
variables:
CONFIG: Release
APP_NAME: SteamWare.Logger
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln"-verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
SteamWare:build:
stage: build
tags:
- win
variables:
CONFIG: Release
APP_NAME: SteamWare
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln"-verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
SteamWare.Reports:build:
stage: build
tags:
- win
variables:
CONFIG: Release
APP_NAME: SteamWare.Reports
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln"-verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
SteamWare.Scheduler:build:
stage: build
tags:
- win
variables:
CONFIG: Release
APP_NAME: SteamWare.Scheduler
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln"-verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
# --------------------------------
# STAGING
# --------------------------------
SteamWare.IO:staging:
stage: staging
needs: ["SteamWare.IO:build"]
tags:
- win
variables:
CONFIG: Debug
APP_NAME: SteamWare.IO
NU_TYPE: Debug
except:
refs:
- main
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln"-verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
- *nuspec-fix
- '& "$env:NUGET_PATH" pack $env:APP_NAME\$env:APP_NAME.csproj -Build -Properties Configuration=$env:CONFIG -Version $env:NUM_DEB -IncludeReferencedProjects'
#- '& "$env:NUGET_PATH" pack "$env:APP_NAME\$env:APP_NAME.nuspec" -properties Configuration=$env:CONFIG -Version $env:NUM_DEB'
- '& "$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'
SteamWare.Logger:staging:
stage: staging
needs: ["SteamWare.Logger:build"]
tags:
- win
variables:
CONFIG: Debug
APP_NAME: SteamWare.Logger
NU_TYPE: Debug
except:
refs:
- main
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln"-verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
- *nuspec-fix
- '& "$env:NUGET_PATH" pack $env:APP_NAME\$env:APP_NAME.csproj -Build -Properties Configuration=$env:CONFIG -Version $env:NUM_DEB -IncludeReferencedProjects'
#- '& "$env:NUGET_PATH" pack "$env:APP_NAME\$env:APP_NAME.nuspec" -properties Configuration=$env:CONFIG -Version $env:NUM_DEB'
- '& "$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'
SteamWare:staging:
stage: staging
needs: ["SteamWare:build"]
tags:
- win
variables:
CONFIG: Debug
APP_NAME: SteamWare
NU_TYPE: Debug
except:
refs:
- main
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln"-verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
- *nuspec-fix
- '& "$env:NUGET_PATH" pack $env:APP_NAME\$env:APP_NAME.csproj -Build -Properties Configuration=$env:CONFIG -Version $env:NUM_DEB -IncludeReferencedProjects'
#- '& "$env:NUGET_PATH" pack "$env:APP_NAME\$env:APP_NAME.nuspec" -properties Configuration=$env:CONFIG -Version $env:NUM_DEB'
- '& "$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'
SteamWare.Reports:staging:
stage: staging
needs: ["SteamWare.Reports:build"]
tags:
- win
variables:
CONFIG: Debug
APP_NAME: SteamWare.Reports
NU_TYPE: Debug
except:
refs:
- main
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln"-verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
- *nuspec-fix
- '& "$env:NUGET_PATH" pack $env:APP_NAME\$env:APP_NAME.csproj -Build -Properties Configuration=$env:CONFIG -Version $env:NUM_DEB -IncludeReferencedProjects'
#- '& "$env:NUGET_PATH" pack "$env:APP_NAME\$env:APP_NAME.nuspec" -properties Configuration=$env:CONFIG -Version $env:NUM_DEB'
- '& "$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'
SteamWare.Scheduler:staging:
stage: staging
needs: ["SteamWare.Scheduler:build"]
tags:
- win
variables:
CONFIG: Debug
APP_NAME: SteamWare.Scheduler
NU_TYPE: Debug
except:
refs:
- main
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln"-verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
- *nuspec-fix
- '& "$env:NUGET_PATH" pack $env:APP_NAME\$env:APP_NAME.csproj -Build -Properties Configuration=$env:CONFIG -Version $env:NUM_DEB -IncludeReferencedProjects'
#- '& "$env:NUGET_PATH" pack "$env:APP_NAME\$env:APP_NAME.nuspec" -properties Configuration=$env:CONFIG -Version $env:NUM_DEB'
- '& "$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'
# --------------------------------
# RELEASE
# --------------------------------
SteamWare.IO:release:
stage: release
needs: ["SteamWare.IO:build"]
tags:
- win
variables:
CONFIG: Release
APP_NAME: SteamWare.IO
only:
refs:
- main
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln"-verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
- *nuspec-fix
- '& "$env:NUGET_PATH" pack $env:APP_NAME\$env:APP_NAME.csproj -Build -Properties Configuration=$env:CONFIG -Version $env:NUM_REL -IncludeReferencedProjects'
#- '& "$env:NUGET_PATH" pack "$env:APP_NAME\$env:APP_NAME.nuspec" -properties Configuration=$env:CONFIG -Version $env:NUM_REL'
- '& "$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'
SteamWare.Logger:release:
stage: release
needs: ["SteamWare.Logger:build"]
tags:
- win
variables:
CONFIG: Release
APP_NAME: SteamWare.Logger
only:
refs:
- main
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln"-verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
- *nuspec-fix
- '& "$env:NUGET_PATH" pack $env:APP_NAME\$env:APP_NAME.csproj -Build -Properties Configuration=$env:CONFIG -Version $env:NUM_REL -IncludeReferencedProjects'
#- '& "$env:NUGET_PATH" pack "$env:APP_NAME\$env:APP_NAME.nuspec" -properties Configuration=$env:CONFIG -Version $env:NUM_REL'
- '& "$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'
SteamWare:release:
stage: release
needs: ["SteamWare:build"]
tags:
- win
variables:
CONFIG: Release
APP_NAME: SteamWare
only:
refs:
- main
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln"-verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
- *nuspec-fix
- '& "$env:NUGET_PATH" pack $env:APP_NAME\$env:APP_NAME.csproj -Build -Properties Configuration=$env:CONFIG -Version $env:NUM_REL -IncludeReferencedProjects'
#- '& "$env:NUGET_PATH" pack "$env:APP_NAME\$env:APP_NAME.nuspec" -properties Configuration=$env:CONFIG -Version $env:NUM_REL'
- '& "$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'
SteamWare.Reports:release:
stage: release
needs: ["SteamWare.Reports:build"]
tags:
- win
variables:
CONFIG: Release
APP_NAME: SteamWare.Reports
only:
refs:
- main
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln"-verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
- *nuspec-fix
- '& "$env:NUGET_PATH" pack $env:APP_NAME\$env:APP_NAME.csproj -Build -Properties Configuration=$env:CONFIG -Version $env:NUM_REL -IncludeReferencedProjects'
#- '& "$env:NUGET_PATH" pack "$env:APP_NAME\$env:APP_NAME.nuspec" -properties Configuration=$env:CONFIG -Version $env:NUM_REL'
- '& "$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'
SteamWare.Scheduler:release:
stage: release
needs: ["SteamWare.Scheduler:build"]
tags:
- win
variables:
CONFIG: Release
APP_NAME: SteamWare.Scheduler
only:
refs:
- main
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln"-verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
- *nuspec-fix
- '& "$env:NUGET_PATH" pack $env:APP_NAME\$env:APP_NAME.csproj -Build -Properties Configuration=$env:CONFIG -Version $env:NUM_REL -IncludeReferencedProjects'
#- '& "$env:NUGET_PATH" pack "$env:APP_NAME\$env:APP_NAME.nuspec" -properties Configuration=$env:CONFIG -Version $env:NUM_REL'
- '& "$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'
# --------------------------------
# DocFx
# --------------------------------
SteamWare.IO:docfx:
stage: docfx
needs: ["SteamWare.IO:build"]
tags:
- win
variables:
CONFIG: Release
APP_NAME: SteamWare.IO
only:
refs:
- main
- master
script:
- docfx $env:APP_NAME/docfx.json
- mv $env:APP_NAME/_site "docfx"
- *DocReplica
SteamWare.Logger:docfx:
stage: docfx
needs: ["SteamWare.Logger:build"]
tags:
- win
variables:
CONFIG: Release
APP_NAME: SteamWare.Logger
only:
refs:
- main
- master
script:
- docfx $env:APP_NAME/docfx.json
- mv $env:APP_NAME/_site "docfx"
- *DocReplica
SteamWare.Reports:docfx:
stage: docfx
needs: ["SteamWare.Reports:build"]
tags:
- win
variables:
CONFIG: Release
APP_NAME: SteamWare.Reports
only:
refs:
- main
- master
script:
- docfx $env:APP_NAME/docfx.json
- mv $env:APP_NAME/_site "docfx"
- *DocReplica
SteamWare.Scheduler:docfx:
stage: docfx
needs: ["SteamWare.Scheduler:build"]
tags:
- win
variables:
CONFIG: Release
APP_NAME: SteamWare.Scheduler
only:
refs:
- main
- master
script:
- docfx $env:APP_NAME/docfx.json
- mv $env:APP_NAME/_site "docfx"
- *DocReplica
SteamWare:docfx:
stage: docfx
needs: ["SteamWare:build"]
tags:
- win
variables:
CONFIG: Release
APP_NAME: SteamWare
only:
refs:
- main
- master
script:
- docfx $env:APP_NAME/docfx.json
- mv $env:APP_NAME/_site "docfx"
- *DocReplica