Files
GPW/.gitlab-ci.yml

275 lines
12 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'
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools'
EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\GPW\Release'
DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds'
VERS_MAIN: '3.1'
NEW_REL: ''
# Da approfondire:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/dotNET.gitlab-ci.yml
# https://www.google.com/search?q=gitlab+variable+year+month&rlz=1C1GCEA_enIT945IT945&oq=gitlab+variable+year+month&aqs=chrome..69i57j69i64.5262j0j7&sourceid=chrome&ie=UTF-8
# https://docs.gitlab.com/ee/ci/examples/README.html
# https://docs.gitlab.com/ee/ci/quick_start/index.html
# https://docs.gitlab.com/ee/ci/yaml/
# helper x fix pacchetti nuget da repo locale nexus.steamware.net
.nuget-fix: &nuget-fix
- |
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C
if ($hasSource -eq 0) {
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
} else {
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
}
echo $hasSource
# helper x fix version number
.version-fix: &version-fix
- |
$env:NEW_REL = $env:VERS_MAIN+"."+(get-date -format yyMM)+"."+(get-date -format ddHH)
echo "Set vers: $env:NEW_REL"
$contenuto = Get-Content -path 'VersGen\GPW.cs' -Raw
$newContenuto = $contenuto -replace '0.0.0.0', $env:NEW_REL
$newContenuto | Set-Content -Path 'VersGen\GPW.cs'
stages:
- build
- staging
- deploy
- installer
# ------------------------------------ BUILD ------------------------------------
ADM:build:
stage: build
tags:
- win
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet' # path alla solution corrente
- *version-fix
script:
- '& "$env:MSBUILD_PATH" GPW_Admin/GPW_Admin.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
COM:build:
stage: build
tags:
- win
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet' # path alla solution corrente
- *version-fix
script:
- '& "$env:MSBUILD_PATH" GPW_Commesse/GPW_Commesse.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
BH:build:
stage: build
tags:
- win
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" GPW_Barcode/GPW_Barcode.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
- '& "$env:MSBUILD_PATH" HOME/HOME.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
Smart:build:
stage: build
tags:
- win
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" GPW_Smart/GPW_Smart.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
# ------------------------------------ STAGING ------------------------------------
ADM:staging:
stage: staging
tags:
- win
only:
- develop
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" /p:m=8 /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=$IIS_PWD /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal GPW_Admin/GPW_Admin.csproj'
needs: ["ADM:build"]
COM:staging:
stage: staging
tags:
- win
only:
- develop
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" /p:m=8 /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=$IIS_PWD /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal GPW_Commesse/GPW_Commesse.csproj'
needs: ["COM:build"]
BH:staging:
stage: staging
tags:
- win
only:
- develop
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" /p:m=8 /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=$IIS_PWD /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal GPW_Barcode/GPW_Barcode.csproj'
- '& "$env:MSBUILD_PATH" /p:m=8 /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=$IIS_PWD /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal HOME/HOME.csproj'
needs: ["BH:build"]
Smart:staging:
stage: staging
tags:
- win
only:
- develop
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet'
- *version-fix
script:
- '& "$env:MSBUILD_PATH" /p:m=8 /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=$IIS_PWD /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal GPW_Smart/GPW_Smart.csproj'
needs: ["Smart:build"]
# ------------------------------------ DEPLOY ------------------------------------
ADM:deploy:
stage: deploy
tags:
- win
only:
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet'
- *version-fix
script:
# IIS PROD
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS-PROD.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=$IIS_PWD /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal GPW_Admin/GPW_Admin.csproj'
needs: ["ADM:build"]
COM:deploy:
stage: deploy
tags:
- win
only:
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet'
- *version-fix
script:
# IIS PROD
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS-PROD.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=$IIS_PWD /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal GPW_Commesse/GPW_Commesse.csproj'
needs: ["COM:build"]
BH:deploy:
stage: deploy
tags:
- win
only:
- master
# rules:
# - if: '$CI_COMMIT_BRANCH == "master"'
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet'
- *version-fix
script:
# IIS PROD
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS-PROD.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=$IIS_PWD /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal GPW_Barcode/GPW_Barcode.csproj'
# IIS PROD
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS-PROD.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=$IIS_PWD /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal HOME/HOME.csproj'
needs: ["BH:build"]
Smart:deploy:
stage: deploy
tags:
- win
only:
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet'
- *version-fix
script:
# IIS PROD
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS-PROD.pubxml /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=$IIS_PWD /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal GPW_Smart/GPW_Smart.csproj'
needs: ["Smart:build"]
# ------------------------------------ INSTALL ------------------------------------
ADM:install:
stage: installer
tags:
- win
only:
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet'
- *version-fix
script:
# Admin ZIP package
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=SPS /p:PublishProfile=SPS.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SPS_PROD/$env:NEW_REL/GPW_Admin.zip /p:DeployIisAppPath="Default Web Site/GPW/ADMIN" /p:PackageAsSingleFile=True /p:OutputPath=bin/ GPW_Admin/GPW_Admin.csproj'
needs: ["ADM:build"]
COM:install:
stage: installer
tags:
- win
only:
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet'
- *version-fix
script:
# Commesse ZIP package
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=SPS /p:PublishProfile=SPS.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SPS_PROD/$env:NEW_REL/GPW_Commesse.zip /p:DeployIisAppPath="Default Web Site/GPW/ADMIN" /p:PackageAsSingleFile=True /p:OutputPath=bin/ GPW_Commesse/GPW_Commesse.csproj'
needs: ["COM:build"]
BH:install:
stage: installer
tags:
- win
only:
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet'
- *version-fix
script:
# BCode ZIP package
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=SPS /p:PublishProfile=SPS.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SPS_PROD/$env:NEW_REL/GPW_Barcode.zip /p:DeployIisAppPath="Default Web Site/GPW/ADMIN" /p:PackageAsSingleFile=True /p:OutputPath=bin/ GPW_Barcode/GPW_Barcode.csproj'
# HOME ZIP package
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=SPS /p:PublishProfile=SPS.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SPS_PROD/$env:NEW_REL/HOME.zip /p:DeployIisAppPath="Default Web Site/GPW/ADMIN" /p:PackageAsSingleFile=True /p:OutputPath=bin/ HOME/HOME.csproj'
needs: ["BH:build"]
Smart:install:
stage: installer
tags:
- win
only:
- master
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore GPW.sln -verbosity quiet'
- *version-fix
script:
# ZIP package
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=SPS /p:PublishProfile=SPS.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SPS_PROD/$env:NEW_REL/GPW_Smart.zip /p:DeployIisAppPath="Default Web Site/GPW/ADMIN" /p:PackageAsSingleFile=True /p:OutputPath=bin/ GPW_Smart/GPW_Smart.csproj'
needs: ["Smart:build"]