139 lines
4.6 KiB
YAML
139 lines
4.6 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'
|
|
# EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\GPW\Release'
|
|
# DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds'
|
|
# NEW_REL: ''
|
|
VERS_MAIN: '0.9'
|
|
NEXUS_PATH: 'GWMS'
|
|
APP_NAME: 'GWMS.UI'
|
|
|
|
# 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 "`"viaDante16`""
|
|
} else {
|
|
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
|
|
}
|
|
echo $hasSource
|
|
|
|
# helper creazione hash files
|
|
.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
|
|
.nexusUpload: &nexusUpload
|
|
- |
|
|
Set-Alias mCurl C:\Windows\system32\curl.exe
|
|
$currentDate = get-date -format yyMM;
|
|
$currentTime = get-date -format ddHH;
|
|
$VersNumb = Get-Content "Resources\VersNum.txt"
|
|
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 http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/$FileName
|
|
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/$VersNumb/$FileName
|
|
}
|
|
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/manifest.xml
|
|
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/ChangeLog.html
|
|
|
|
|
|
# mCurl -v -u $env:NEXUS_USER:$env:NEXUS_PASSWD --upload-file bin/release/$env:APP_NAME.zip $env:NEXUS_SERVER/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip
|
|
|
|
stages:
|
|
- build
|
|
- test
|
|
# - deploy
|
|
- installer
|
|
- release
|
|
|
|
build:
|
|
stage: build
|
|
before_script:
|
|
- *nuget-fix
|
|
- dotnet restore
|
|
script:
|
|
- dotnet build
|
|
|
|
test:
|
|
stage: test
|
|
only:
|
|
- develop
|
|
needs: ["build"]
|
|
script:
|
|
- dotnet test
|
|
|
|
# IIS01:deploy:
|
|
# stage: deploy
|
|
# only:
|
|
# - develop
|
|
# needs: ["test"]
|
|
# # before_script:
|
|
# # - *nuget-fix
|
|
# # - dotnet restore
|
|
# script:
|
|
# - dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true GWMS.UI/GWMS.UI.csproj
|
|
|
|
|
|
# IIS02:deploy:
|
|
# stage: deploy
|
|
# only:
|
|
# - master
|
|
# needs: ["build"]
|
|
# # before_script:
|
|
# # - *nuget-fix
|
|
# # - dotnet restore
|
|
# script:
|
|
# - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true GWMS.UI/GWMS.UI.csproj
|
|
# - dotnet publish -p:PublishProfile=W2019-IIS-DEVProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true GWMS.UI/GWMS.UI.csproj
|
|
|
|
installer:
|
|
stage: installer
|
|
only:
|
|
- develop
|
|
- master
|
|
needs: ["build"]
|
|
before_script:
|
|
# - *nuget-fix
|
|
# - dotnet restore
|
|
script:
|
|
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release GWMS.UI/GWMS.UI.csproj -o:publish
|
|
# qui il deploy su nexus...
|
|
- *hashBuild
|
|
- *nexusUpload
|
|
|
|
release:
|
|
stage: release
|
|
only:
|
|
#- feature/Deploy_CI_CD
|
|
# - master
|
|
- tags
|
|
except:
|
|
- branches
|
|
needs: ["build"]
|
|
artifacts:
|
|
paths:
|
|
- publish/
|
|
script:
|
|
- dotnet publish -c Release -o ./publish GWMS.UI/GWMS.UI.csproj |