Files
2024-02-24 11:54:34 +01:00

247 lines
8.4 KiB
YAML

variables:
VERS_MAIN: '1.5'
NEW_REL: ''
NUM_REL: '0.1.2.3'
NUM_DEB: '0.1.2-beta.3'
NU_TYPE: 'Debug'
APP_NAME: 'EgwCoreLib.Razor'
SOL_NAME: 'EgwCoreLib.Razor'
NUGET_PATH: 'C:\Tools\nuget.exe'
NEW_COPYRIGHT: 'EgalWare 2022+'
# 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-proxy-v3"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source nexus-proxy-v3
}
$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'
}
dotnet nuget add source https://nexus.steamware.net/repository/nuget-group-3/index.json -n "Steamware Nexus" -u nugetUser -p $NEXUS_PASSWD --store-password-in-clear-text
echo "Steamware Nexus Source added"
# 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 @ 2022-" + (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 $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"
# helper x rename nuspec file debug/beta
.renameDeb: &renameDeb
- |
echo "Cambio nome nuget di sviluppo"
$fileNameRel = "$env:APP_NAME/bin/Debug/$env:APP_NAME.$env:NUM_REL.nupkg";
$fileNameDeb = $fileNameRel -replace $env:NUM_REL, $env:NUM_DEB;
echo "Move-Item $fileNameRel $fileNameDeb"
Move-Item $fileNameRel $fileNameDeb
stages:
- build
- deploy
- release
# ---------- BUILD ----------
EgwCoreLib.Utils:build:
stage: build
tags:
- win
variables:
APP_NAME: EgwCoreLib.Utils
SOL_NAME: EgwCoreLib
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
- *version-fix
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
EgwCoreLib.Razor:build:
stage: build
tags:
- win
variables:
APP_NAME: EgwCoreLib.Razor
SOL_NAME: EgwCoreLib
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
- *version-fix
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
EgwCoreLib.BlazorTest:build:
stage: build
tags:
- win
variables:
APP_NAME: EgwCoreLib.BlazorTest
SOL_NAME: EgwCoreLib
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
- *version-fix
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# ----- Start DEPLOY develop (IIS01) -----
EgwCoreLib.BlazorTest:IIS01:deploy:
stage: deploy
tags:
- win
variables:
APP_NAME: EgwCoreLib.BlazorTest
SOL_NAME: EgwCoreLib
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
- *version-fix
rules:
- if: $CI_COMMIT_BRANCH == 'develop'
needs: ["EgwCoreLib.BlazorTest: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
# ---------- Upload Debug/Unstable ----------
EgwCoreLib.Razor:release-dev:
stage: release
tags:
- win
variables:
APP_NAME: EgwCoreLib.Razor
SOL_NAME: EgwCoreLib
only:
- develop
needs: ["EgwCoreLib.Razor: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
# - *renameDeb
- '& "$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.Utils:release-dev:
stage: release
tags:
- win
variables:
APP_NAME: EgwCoreLib.Utils
SOL_NAME: EgwCoreLib
only:
- develop
needs: ["EgwCoreLib.Utils: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
# - *renameDeb
- '& "$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'
# ---------- RELEASE ----------
EgwCoreLib.Razor:release-rel:
stage: release
tags:
- win
variables:
APP_NAME: EgwCoreLib.Razor
SOL_NAME: EgwCoreLib
NU_TYPE: Release
only:
- main
needs: ["EgwCoreLib.Razor: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_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
EgwCoreLib.Utils:release-rel:
stage: release
tags:
- win
variables:
APP_NAME: EgwCoreLib.Utils
SOL_NAME: EgwCoreLib
NU_TYPE: Release
only:
- main
needs: ["EgwCoreLib.Utils: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_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'