Files
mapo-mono/.gitlab-ci.yml
Samuele Locatelli 115a9c3cc3 DATA:
- Update conf sqlScripts
- migration x TaskExec
- views/stored creation (maybe)
2023-03-29 17:48:44 +02:00

295 lines
8.4 KiB
YAML

variables:
VERS_MAIN: '0.9'
NEW_REL: ''
APP_NAME: ''
APP_CONF: 'Release'
# Step esecuzione script powershell x code obfuscation (tool install + esecuzione)
.obfuscate: &obfuscate
- |
obfuscate.ps1
# 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 https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`"" -StorePasswordInClearText
} else {
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`"" -StorePasswordInClearText
}
echo $hasSource
# helper creazione hash files x IIS
.hashBuild: &hashBuild
- |
$Target = "$env:APP_NAME\Releases\" + $CI_COMMIT_BRANCH + "\" + $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
$currentDate = get-date -format yyMM;
$currentTime = get-date -format ddHH;
$fileVers = $env:APP_NAME + "\Resources\VersNum.txt"
$VersNumb = Get-Content $fileVers
echo "Curr Version: $VersNumb"
if($CI_COMMIT_BRANCH -eq "main")
{
$version = "stable"
}
else
{
$version = "unstable"
}
$File2Send = Get-ChildItem("$env:APP_NAME\Releases\" + $CI_COMMIT_BRANCH + "\*")
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:APP_NAME/$version/LAST/$FileName
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:APP_NAME/$version/ARCHIVE/$VersNumb/$FileName
echo "mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:APP_NAME/$version/LAST/$FileName"
}
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "$env:APP_NAME\Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:APP_NAME/$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:APP_NAME/$version/LAST/ChangeLog.html
# helper creazione files zip x app console
.artifactZipper: &artifactZipper
- |
$7zipPath = $env:ProgramFiles+"\7-Zip\7z.exe"
if (-not (Test-Path -Path $7zipPath -PathType Leaf)) {
throw "7 zip file '$7zipPath' not found"
}
Set-Alias 7zip $7zipPath
$Target = "$env:APP_NAME\Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip"
$Source = "$env:APP_NAME\bin\$env:APP_CONF\net6.0\publish\win-x64\*"
7zip a -tzip $Target $Source -xr!DATA
echo "called ZIP $Source --> $Target"
# helper copia pubblicati in dir x upload
.artifactMover: &artifactMover
- |
$Target = "$env:APP_NAME\Releases\" + $CI_COMMIT_BRANCH + "\"
$Source = "$env:APP_NAME\bin\publish\net6.0\"
ROBOCOPY $Source $Target /MIR
echo "called ROBOCOPY $Source --> $Target"
stages:
- build
- staging
- deploy
- pack
ADAPTER:build:
stage: build
tags:
- win
variables:
APP_NAME: MP.MONO.ADAPTER.OPC
before_script:
- *nuget-fix
- dotnet restore MP.MONO.ALL.sln
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
DECODER:build:
stage: build
tags:
- win
variables:
APP_NAME: MP.MONO.DECODER
before_script:
- *nuget-fix
- dotnet restore MP.MONO.ALL.sln
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
SIM:build:
stage: build
tags:
- win
variables:
APP_NAME: MP.MONO.SIM
before_script:
- *nuget-fix
- dotnet restore MP.MONO.ALL.sln
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
UI:build:
stage: build
tags:
- win
variables:
APP_NAME: MP.MONO.UI
before_script:
- *nuget-fix
- dotnet restore MP.MONO.ALL.sln
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
UI:staging:
stage: staging
tags:
- win
variables:
APP_NAME: MP.MONO.UI
only:
- develop
needs: ["UI:build"]
script:
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
UI:deploy:
stage: deploy
tags:
- win
variables:
APP_NAME: MP.MONO.UI
only:
- main
needs: ["UI:build"]
script:
# IIS02
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
# IIS04
- dotnet publish -p:PublishProfile=IIS04.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
ADAPTER:packDebug:
stage: pack
tags:
- win
only:
- develop
variables:
APP_NAME: MP.MONO.ADAPTER.OPC
APP_CONF: Debug
needs: ["ADAPTER:build"]
script:
- dotnet publish -p:PublishProfile=SingleAppDebug.pubxml -p:RunCodeAnalysis=false -p:Configuration=$env:APP_CONF $env:APP_NAME/$env:APP_NAME.csproj
- *artifactZipper
- *hashBuild
- *nexusUpload
DECODER:packDebug:
stage: pack
tags:
- win
only:
- develop
variables:
APP_NAME: MP.MONO.DECODER
APP_CONF: Debug
needs: ["DECODER:build"]
script:
- dotnet publish -p:PublishProfile=SingleAppDebug.pubxml -p:RunCodeAnalysis=false -p:Configuration=$env:APP_CONF $env:APP_NAME/$env:APP_NAME.csproj
- *artifactZipper
- *hashBuild
- *nexusUpload
SIM:packDebug:
stage: pack
tags:
- win
only:
- develop
variables:
APP_NAME: MP.MONO.SIM
APP_CONF: Debug
needs: ["SIM:build"]
script:
- dotnet publish -p:PublishProfile=SingleAppDebug.pubxml -p:RunCodeAnalysis=false -p:Configuration=$env:APP_CONF $env:APP_NAME/$env:APP_NAME.csproj
- *artifactZipper
- *hashBuild
- *nexusUpload
UI:packDebug:
stage: pack
tags:
- win
only:
- develop
variables:
APP_NAME: MP.MONO.UI
APP_CONF: Debug
needs: ["UI:build"]
script:
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=$env:APP_CONF $env:APP_NAME/$env:APP_NAME.csproj -o:publish
- *artifactMover
- *hashBuild
- *nexusUpload
ADAPTER:packRelease:
stage: pack
tags:
- win
only:
- main
variables:
APP_NAME: MP.MONO.ADAPTER.OPC
APP_CONF: Release
needs: ["ADAPTER:build"]
script:
- dotnet publish -p:PublishProfile=SingleApp.pubxml -p:RunCodeAnalysis=false -p:Configuration=$env:APP_CONF $env:APP_NAME/$env:APP_NAME.csproj
- *artifactZipper
- *hashBuild
- *nexusUpload
DECODER:packRelease:
stage: pack
tags:
- win
only:
- main
variables:
APP_NAME: MP.MONO.DECODER
APP_CONF: Release
needs: ["DECODER:build"]
script:
- dotnet publish -p:PublishProfile=SingleApp.pubxml -p:RunCodeAnalysis=false -p:Configuration=$env:APP_CONF $env:APP_NAME/$env:APP_NAME.csproj
- *artifactZipper
- *hashBuild
- *nexusUpload
SIM:packRelease:
stage: pack
tags:
- win
only:
- main
variables:
APP_NAME: MP.MONO.SIM
APP_CONF: Release
needs: ["SIM:build"]
script:
- dotnet publish -p:PublishProfile=SingleApp.pubxml -p:RunCodeAnalysis=false -p:Configuration=$env:APP_CONF $env:APP_NAME/$env:APP_NAME.csproj
- *artifactZipper
- *hashBuild
- *nexusUpload
UI:packRelease:
stage: pack
tags:
- win
only:
- main
variables:
APP_NAME: MP.MONO.UI
APP_CONF: Release
needs: ["UI:build"]
script:
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=$env:APP_CONF $env:APP_NAME/$env:APP_NAME.csproj -o:publish
- *artifactMover
- *hashBuild
- *nexusUpload