119 lines
3.8 KiB
YAML
119 lines
3.8 KiB
YAML
variables:
|
|
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 https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
|
|
} else {
|
|
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://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 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 "Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml
|
|
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/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
|
|
- installer
|
|
- release
|
|
|
|
build:
|
|
stage: build
|
|
tags:
|
|
- win
|
|
before_script:
|
|
- *nuget-fix
|
|
- dotnet restore GWMS.sln
|
|
script:
|
|
- dotnet build -p:Configuration=Release GWMS.UI/GWMS.UI.csproj
|
|
|
|
test:
|
|
stage: test
|
|
tags:
|
|
- win
|
|
only:
|
|
- develop
|
|
needs: ["build"]
|
|
script:
|
|
- dotnet test -p:Configuration=Release GWMS.UI/GWMS.UI.csproj
|
|
|
|
installer:
|
|
stage: installer
|
|
tags:
|
|
- win
|
|
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
|
|
# pubblico solo installer Linux x64: https://docs.microsoft.com/en-us/dotnet/core/deploying/
|
|
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release GWMS.UI/GWMS.UI.csproj -o:publish -r linux-x64 --self-contained false
|
|
# qui il deploy su nexus...
|
|
- *hashBuild
|
|
- *nexusUpload
|
|
|
|
release:
|
|
stage: release
|
|
tags:
|
|
- win
|
|
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 |