Files
2024-04-23 11:29:43 +02:00

240 lines
8.2 KiB
YAML

variables:
VERS_MAIN: '0.9'
NEW_REL: ''
APP_NAME: 'WDC.UI'
SOL_NAME: 'WebDoorCreator.UI'
# 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
}
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 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
stages:
- build
- staging
- deploy
- release
# ---------- BUILD ----------
WDC.Api:build:
stage: build
tags:
- win
variables:
APP_NAME: WebDoorCreator.API
SOL_NAME: WebDoorCreator.UI
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
WDC.UI:build:
stage: build
tags:
- win
variables:
APP_NAME: WebDoorCreator.UI
SOL_NAME: WebDoorCreator.UI
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# ---------- STAGING ----------
WDC.Api:staging:
stage: staging
tags:
- win
environment:
name: staging
url: https://iis01.egalware.com/WDC/SRV/
variables:
APP_NAME: WebDoorCreator.API
SOL_NAME: WebDoorCreator.UI
only:
- develop
needs: ["WDC.Api:build"]
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
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
## IIS 02
#- dotnet publish -p:PublishProfile=IIS02.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
WDC.UI:staging:
stage: staging
tags:
- win
environment:
name: staging
url: https://iis01.egalware.com/WDC/UI/
variables:
APP_NAME: WebDoorCreator.UI
SOL_NAME: WebDoorCreator.UI
only:
- develop
needs: ["WDC.UI:build"]
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
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
# ---------- DEPLOY ----------
WDC.Api:deploy:
stage: deploy
tags:
- win
environment:
name: production
url: https://wdc.egalware.com/SRV/
variables:
APP_NAME: WebDoorCreator.API
SOL_NAME: WebDoorCreator.UI
only:
- main
needs: ["WDC.Api:build"]
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# IIS OVH IIS01
- dotnet publish -p:PublishProfile=IIS-OVH-IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=steamware -p:Password=$WDC_IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
# IIS OVH IIS02
- dotnet publish -p:PublishProfile=IIS-OVH-IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=steamware -p:Password=$WDC_IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
WDC.UI:deploy:
stage: deploy
tags:
- win
environment:
name: production
url: https://wdc.egalware.com/UI/
variables:
APP_NAME: WebDoorCreator.UI
SOL_NAME: WebDoorCreator.UI
only:
- main
needs: ["WDC.UI:build"]
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# IIS OVH IIS01
- dotnet publish -p:PublishProfile=IIS-OVH-IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=steamware -p:Password=$WDC_IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
# IIS OVH IIS02
- dotnet publish -p:PublishProfile=IIS-OVH-IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=steamware -p:Password=$WDC_IIS_PWD -p:AllowUntrustedCertificate=true -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
## IIS PROD
#- dotnet publish -p:PublishProfile=IIS-PROD.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
# ---------- RELEASE ----------
WDC.Api:release:
stage: release
tags:
- win
variables:
APP_NAME: WebDoorCreator.API
SOL_NAME: WebDoorCreator.UI
only:
- main
except:
- branches
needs: ["WDC.Api:build"]
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
artifacts:
paths:
- publish/
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
# script:
# - dotnet publish -c Release -o ./publish GPW.WDC.Api/GPW.WDC.Api.csproj
WDC.UI:release:
stage: release
tags:
- win
variables:
APP_NAME: WebDoorCreator.UI
SOL_NAME: WebDoorCreator.UI
only:
- main
except:
- branches
needs: ["WDC.UI:build"]
artifacts:
paths:
- publish/
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
# script:
# - dotnet publish -c Release -o ./publish GPW.CORE.WRKLOG/GPW.CORE.WRKLOG.csproj