387 lines
14 KiB
YAML
387 lines
14 KiB
YAML
variables:
|
|
VERS_MAIN: '1.0'
|
|
NEXUS_PATH: 'LUX'
|
|
PROJ_PATH: ''
|
|
NUM_REL: '0.1.2.3'
|
|
NU_TYPE: 'Debug'
|
|
APP_NAME: 'Test.UI'
|
|
SOL_NAME: 'WebWindowConfigurator'
|
|
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: se debug aggiunge -beta nel blocco 3 del SemVer
|
|
.nuspec-fix: &nuspec-fix
|
|
- |
|
|
echo "Modifica dati versione pacchetto nuget"
|
|
$fileNameRel = "$env:APP_NAME/$env:APP_NAME.csproj";
|
|
$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_REL = $vers -replace '^(\d+)\.(\d+)\.(\d+)\.(\d+)$', '$1.$2.$3-beta.$4'
|
|
}
|
|
elseif($env:NU_TYPE -eq "Release")
|
|
{
|
|
$env:NUM_REL = $vers
|
|
}
|
|
echo "Versione calcolata: $env:NUM_REL"
|
|
$findVers = "<Version>(.|\n)*?</Version>";
|
|
$replVers = "<Version>" + $env:NUM_REL + "</Version>";
|
|
$newContent = $fileContent -replace $findVers, $replVers;
|
|
Set-Content -Path $fileNameRel -Value $newContent;
|
|
echo "Modifica dati file progetto x nuspec completata su file $fileNameRel"
|
|
|
|
# Stages previsti
|
|
stages:
|
|
- build
|
|
- deploy
|
|
# - installer
|
|
- release
|
|
|
|
# --------------------------------
|
|
# BUILD
|
|
# --------------------------------
|
|
Test.UI:build:
|
|
stage: build
|
|
tags:
|
|
- win
|
|
variables:
|
|
APP_NAME: Test.UI
|
|
SOL_NAME: WebWindowConfigurator
|
|
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: WebWindowConfigurator
|
|
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
|
|
|
|
WebWindow.Base:SDK:deploy:
|
|
stage: deploy
|
|
tags:
|
|
- win
|
|
variables:
|
|
APP_NAME: WebWindow.Base
|
|
SOL_NAME: WebWindowConfigurator
|
|
NU_TYPE: Debug
|
|
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
|
|
- *nuspec-fix
|
|
- dotnet pack -p:Configuration=Debug -p:verbosity=quiet --output $env:APP_NAME/bin/ $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/Egw.Lux.$env:APP_NAME.$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
|
|
|
|
WebWindowConfigurator:SDK:deploy:
|
|
stage: deploy
|
|
tags:
|
|
- win
|
|
variables:
|
|
APP_NAME: WebWindowConfigurator
|
|
SOL_NAME: WebWindowConfigurator
|
|
NU_TYPE: Debug
|
|
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
|
|
- *nuspec-fix
|
|
- dotnet pack -p:Configuration=Debug -p:verbosity=quiet --output $env:APP_NAME/bin/ $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/Egw.Lux.$env:APP_NAME.$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
|
|
|
|
WebWindowComplex:SDK:deploy:
|
|
stage: deploy
|
|
tags:
|
|
- win
|
|
variables:
|
|
APP_NAME: WebWindowComplex
|
|
SOL_NAME: WebWindowConfigurator
|
|
NU_TYPE: Debug
|
|
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
|
|
- *nuspec-fix
|
|
- dotnet pack -p:Configuration=Debug -p:verbosity=quiet --output $env:APP_NAME/bin/ $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/Egw.Lux.$env:APP_NAME.$env:NUM_REL.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: WebWindowConfigurator
|
|
# 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: WebWindowConfigurator
|
|
# 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: WebWindowConfigurator
|
|
# 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
|
|
|
|
WebWindow.Base:SDK:release:
|
|
stage: release
|
|
tags:
|
|
- win
|
|
variables:
|
|
APP_NAME: WebWindow.Base
|
|
SOL_NAME: WebWindowConfigurator
|
|
NU_TYPE: Release
|
|
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
|
|
- *nuspec-fix
|
|
- dotnet pack -p:Configuration=Debug -p:verbosity=quiet --output $env:APP_NAME/bin/ $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/Egw.Lux.$env:APP_NAME.$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
|
|
|
|
WebWindowConfigurator:SDK:release:
|
|
stage: release
|
|
tags:
|
|
- win
|
|
variables:
|
|
APP_NAME: WebWindowConfigurator
|
|
SOL_NAME: WebWindowConfigurator
|
|
NU_TYPE: Release
|
|
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
|
|
- *nuspec-fix
|
|
- dotnet pack -p:Configuration=Debug -p:verbosity=quiet --output $env:APP_NAME/bin/ $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/Egw.Lux.$env:APP_NAME.$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
|
|
|
|
WebWindowComplex:SDK:release:
|
|
stage: release
|
|
tags:
|
|
- win
|
|
variables:
|
|
APP_NAME: WebWindowComplex
|
|
SOL_NAME: WebWindowConfigurator
|
|
NU_TYPE: Release
|
|
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
|
|
- *nuspec-fix
|
|
- dotnet pack -p:Configuration=Debug -p:verbosity=quiet --output $env:APP_NAME/bin/ $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/Egw.Lux.$env:APP_NAME.$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
|