307 lines
11 KiB
YAML
307 lines
11 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'
|
|
ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools'
|
|
VERS_MAIN: '1.3'
|
|
NEW_REL: ''
|
|
NEXUS_PATH: 'StockMan'
|
|
APP_NAME: 'StockManMVC'
|
|
SOL_NAME: 'StockManMVC'
|
|
APP_CONF: 'Release'
|
|
APP_VERS: 'unstable'
|
|
PROJ_NAME: 'StockManMVC'
|
|
|
|
|
|
# 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 version number
|
|
.version-fix: &version-fix
|
|
- |
|
|
# Esecuzione fix numero versione x pack nuget
|
|
$fileName = "VersGen\VersGen.cs";
|
|
# calcolo nuova
|
|
$env:NEW_REL = $env:VERS_MAIN+"."+(get-date -format yyMM)+"."+(get-date -format dHH)
|
|
echo "New vers: $env:NEW_REL"
|
|
# aggiorno file
|
|
$contenuto = Get-Content -path $fileName -Raw
|
|
$newContenuto = $contenuto -replace '0.0.0.0', $env:NEW_REL
|
|
$newContenuto | Set-Content -path $fileName
|
|
|
|
# helper x fix manifest xml
|
|
.manifest-fix: &manifest-fix
|
|
- |
|
|
echo "Set manifest.xml for branch: $CI_COMMIT_BRANCH"
|
|
$fileName = 'Resources\manifest.xml'
|
|
$contenuto = Get-Content -path $fileName -Raw
|
|
$newContenuto = $contenuto -replace '{{BRANCHNAME}}', $CI_COMMIT_BRANCH
|
|
$newContenuto = $newContenuto -replace '{{PACKNAME}}', $env:APP_NAME
|
|
$newContenuto = $newContenuto -replace '0.0.0.0', $env:NEW_REL
|
|
$newContenuto | Set-Content -path $fileName
|
|
|
|
# helper creazione hash files
|
|
.hashBuild: &hashBuild
|
|
- |
|
|
# hashBuild per elaborato
|
|
$Target = ".\$env:APP_NAME\Release\$env:APP_NAME.zip"
|
|
echo "Request hash for $Target"
|
|
$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
|
|
.nexusUpload: &nexusUpload
|
|
- |
|
|
Set-Alias mCurl C:\Windows\system32\curl.exe
|
|
$currentDate = get-date -format yyMM;
|
|
$currentTime = get-date -format ddHH;
|
|
$VersNumb = $env:NEW_REL
|
|
echo "Curr Version: $VersNumb"
|
|
if($CI_COMMIT_BRANCH -eq "master")
|
|
{
|
|
$version = "stable"
|
|
}
|
|
else
|
|
{
|
|
$version = "unstable"
|
|
}
|
|
$File2Send = Get-ChildItem("$env:PROJ_NAME\Release\*")
|
|
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/$CI_COMMIT_BRANCH/LAST/$FileName
|
|
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$CI_COMMIT_BRANCH/ARCHIVE/$VersNumb/$FileName
|
|
}
|
|
#mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "$env:PROJ_NAME\Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$CI_COMMIT_BRANCH/LAST/manifest.xml
|
|
#mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "$env:PROJ_NAME\Resources\ChangeLog.html" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$CI_COMMIT_BRANCH/LAST/ChangeLog.html
|
|
|
|
stages:
|
|
- build
|
|
- deploy
|
|
- release
|
|
|
|
StockManMVC:build:
|
|
stage: build
|
|
tags:
|
|
- win
|
|
variables:
|
|
APP_NAME: StockManMVC
|
|
SOL_NAME: StockManMVC
|
|
before_script:
|
|
- *nuget-fix
|
|
# - dotnet restore "$env:SOL_NAME.sln"
|
|
- '& "$env:NUGET_PATH" restore StockManMVC.sln -Verbosity quiet'
|
|
- *version-fix
|
|
script:
|
|
- '& "$env:MSBUILD_PATH" $env:APP_NAME/$env:APP_NAME.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
|
|
|
|
|
|
StockMan.CORE:build:
|
|
stage: build
|
|
tags:
|
|
- win
|
|
variables:
|
|
APP_NAME: StockMan.CORE
|
|
SOL_NAME: StockMan.CORE
|
|
before_script:
|
|
- *nuget-fix
|
|
- dotnet restore "$env:SOL_NAME.sln"
|
|
- *version-fix
|
|
script:
|
|
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
|
|
|
StockManMVC:IIS01:deploy:
|
|
stage: deploy
|
|
tags:
|
|
- win
|
|
variables:
|
|
APP_NAME: StockManMVC
|
|
SOL_NAME: StockManMVC
|
|
except:
|
|
refs:
|
|
- main
|
|
- master
|
|
before_script:
|
|
- *nuget-fix
|
|
- '& "$env:NUGET_PATH" restore StockManMVC.sln -Verbosity quiet'
|
|
- *version-fix
|
|
needs: ["StockManMVC:build"]
|
|
script:
|
|
- '& "$env:MSBUILD_PATH" /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS01.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal $env:APP_NAME/$env:APP_NAME.csproj'
|
|
|
|
|
|
StockMan.CORE:IIS01:deploy:
|
|
stage: deploy
|
|
tags:
|
|
- win
|
|
variables:
|
|
APP_NAME: StockMan.CORE
|
|
SOL_NAME: StockMan.CORE
|
|
before_script:
|
|
- *nuget-fix
|
|
- dotnet restore "$env:SOL_NAME.sln"
|
|
only:
|
|
- develop
|
|
needs: ["StockMan.CORE: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
|
|
|
|
|
|
|
|
StockMan_TK:IIS01:deploy:
|
|
stage: deploy
|
|
tags:
|
|
- win
|
|
variables:
|
|
APP_NAME: StockManMVC
|
|
SOL_NAME: StockManMVC
|
|
except:
|
|
refs:
|
|
- main
|
|
- master
|
|
before_script:
|
|
- *nuget-fix
|
|
- '& "$env:NUGET_PATH" restore StockManMVC.sln -Verbosity quiet'
|
|
- *version-fix
|
|
needs: ["StockManMVC:build"]
|
|
script:
|
|
- '& "$env:MSBUILD_PATH" /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS01_TK.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal $env:APP_NAME/$env:APP_NAME.csproj'
|
|
|
|
StockManMVC:IIS02:deploy:
|
|
stage: deploy
|
|
tags:
|
|
- win
|
|
only:
|
|
refs:
|
|
- main
|
|
- master
|
|
before_script:
|
|
- *nuget-fix
|
|
- '& "$env:NUGET_PATH" restore StockManMVC.sln -Verbosity quiet'
|
|
- *version-fix
|
|
script:
|
|
- '& "$env:MSBUILD_PATH" /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS02.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal $env:APP_NAME/$env:APP_NAME.csproj'
|
|
needs: ["StockManMVC:build"]
|
|
|
|
StockMan_TK:IIS02:deploy:
|
|
stage: deploy
|
|
tags:
|
|
- win
|
|
only:
|
|
refs:
|
|
- main
|
|
- master
|
|
before_script:
|
|
- *nuget-fix
|
|
- '& "$env:NUGET_PATH" restore StockManMVC.sln -Verbosity quiet'
|
|
- *version-fix
|
|
script:
|
|
- '& "$env:MSBUILD_PATH" /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS02_TK.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal $env:APP_NAME/$env:APP_NAME.csproj'
|
|
needs: ["StockManMVC:build"]
|
|
|
|
StockManMVC:IIS03:deploy:
|
|
stage: deploy
|
|
tags:
|
|
- win
|
|
only:
|
|
refs:
|
|
- main
|
|
- master
|
|
before_script:
|
|
- *nuget-fix
|
|
- '& "$env:NUGET_PATH" restore StockManMVC.sln -Verbosity quiet'
|
|
- *version-fix
|
|
script:
|
|
- '& "$env:MSBUILD_PATH" /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS03.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal $env:APP_NAME/$env:APP_NAME.csproj'
|
|
needs: ["StockManMVC:build"]
|
|
|
|
StockMan_TK:IIS03:deploy:
|
|
stage: deploy
|
|
tags:
|
|
- win
|
|
only:
|
|
refs:
|
|
- main
|
|
- master
|
|
before_script:
|
|
- *nuget-fix
|
|
- '& "$env:NUGET_PATH" restore StockManMVC.sln -Verbosity quiet'
|
|
- *version-fix
|
|
script:
|
|
- '& "$env:MSBUILD_PATH" /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS03_TK.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal $env:APP_NAME/$env:APP_NAME.csproj'
|
|
needs: ["StockManMVC:build"]
|
|
|
|
StockManMVC:Test:release:
|
|
stage: release
|
|
tags:
|
|
- win
|
|
variables:
|
|
APP_VERS: unstable
|
|
except:
|
|
refs:
|
|
- main
|
|
- master
|
|
before_script:
|
|
- *nuget-fix
|
|
- '& "$env:NUGET_PATH" restore StockManMVC.sln -Verbosity quiet'
|
|
- *version-fix
|
|
script:
|
|
- '& "$env:MSBUILD_PATH" /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=TK_test.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal $env:APP_NAME/$env:APP_NAME.csproj'
|
|
- *hashBuild
|
|
- *nexusUpload
|
|
needs: ["StockManMVC:build"]
|
|
|
|
|
|
StockManMVC:Prod:release:
|
|
stage: release
|
|
tags:
|
|
- win
|
|
variables:
|
|
APP_VERS: stable
|
|
only:
|
|
refs:
|
|
- main
|
|
- master
|
|
before_script:
|
|
- *nuget-fix
|
|
- '& "$env:NUGET_PATH" restore StockManMVC.sln -Verbosity quiet'
|
|
- *version-fix
|
|
script:
|
|
- '& "$env:MSBUILD_PATH" /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=TK_prod.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal $env:APP_NAME/$env:APP_NAME.csproj'
|
|
- *hashBuild
|
|
- *nexusUpload
|
|
needs: ["StockManMVC:build"]
|