fcf2dab1b5
- correzione path provenienza file
115 lines
4.5 KiB
YAML
115 lines
4.5 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'
|
||
NEXUS_PATH: 'SOUR'
|
||
APP_NAME: 'SOUR'
|
||
SOL_NAME: 'SOUR'
|
||
CONFIG: 'Release'
|
||
VERS_MAIN: '2.0'
|
||
NEW_REL: ''
|
||
OUTPUT_DIR: ''
|
||
|
||
# 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 "`"$NEXUS_PASSWD`""
|
||
} else {
|
||
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
|
||
}
|
||
echo $hasSource
|
||
|
||
# $env:NEW_REL = $env:VERS_MAIN+"."+(get-date –format yyMM)+"."+$CI_PIPELINE_IID
|
||
# helper x fix version number
|
||
.version-fix: &version-fix
|
||
- |
|
||
$env:NEW_REL = $env:VERS_MAIN+"."+(get-date –format yyMM)+"."+(get-date –format dHH)
|
||
$contenuto = Get-Content -path 'src\SharedAssemblyInfo.cs' -Raw
|
||
$newContenuto = $contenuto -replace '1.0.0.0', $env:NEW_REL
|
||
$newContenuto | Set-Content -Path 'src\SharedAssemblyInfo.cs'
|
||
echo "Set vers: $env:NEW_REL"
|
||
if($CI_COMMIT_BRANCH = "develop")
|
||
{
|
||
$env:CONFIG = "Debug"
|
||
}
|
||
|
||
# helper creazione hash files
|
||
.hashBuild: &hashBuild
|
||
- |
|
||
$Target = "src\SOUR.Setup\bin\SOUR.msi"
|
||
$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 = $env:NEW_REL
|
||
echo "Curr Version: $VersNumb"
|
||
$FileMsi="src\SOUR.Setup\bin\SOUR.msi"
|
||
$FileName="SOUR.msi"
|
||
if($CI_COMMIT_BRANCH -eq "master")
|
||
{
|
||
$version = "stable"
|
||
}
|
||
else
|
||
{
|
||
$version = "unstable"
|
||
}
|
||
$File2Send = Get-ChildItem("src\SOUR.Setup\bin\*")
|
||
ForEach ($File in $File2Send) {
|
||
$FileName = Split-Path $File -leaf
|
||
echo "mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName"
|
||
mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName
|
||
echo "mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName"
|
||
mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName
|
||
}
|
||
|
||
# echo "mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $FileMsi https://repository.scmgroup.com/repository/mconnect-raw/SOUR.msi"
|
||
# mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $FileMsi https://repository.scmgroup.com/repository/mconnect-raw/SOUR.msil
|
||
|
||
stages:
|
||
- build
|
||
- release
|
||
|
||
SOUR:Build:
|
||
stage: build
|
||
tags:
|
||
- win
|
||
before_script:
|
||
- *nuget-fix
|
||
- '& "$env:NUGET_PATH" restore "src\$env:SOL_NAME.sln"' # path alla solution corrente
|
||
- *version-fix
|
||
script:
|
||
- '& "$env:MSBUILD_PATH" "src\$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m'
|
||
|
||
SOUR:Release:
|
||
stage: release
|
||
tags:
|
||
- win
|
||
only:
|
||
refs:
|
||
- develop
|
||
- main
|
||
- master
|
||
before_script:
|
||
- *nuget-fix
|
||
- '& "$env:NUGET_PATH" restore "src\$env:SOL_NAME.sln"' # path alla solution corrente
|
||
- *version-fix
|
||
script:
|
||
# compilo programma
|
||
- '& "$env:MSBUILD_PATH" "src\$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="x86" /p:OutputPath=bin/ /verbosity:minimal /m'
|
||
# creo installer msi
|
||
- '& "$env:MSBUILD_PATH" src\SOUR.Setup\SOUR.Setup.wixproj /p:Configuration=$env:CONFIG /p:Platform="x86" /p:ProdVersion=$env:NEW_REL /p:OutputPath=bin/ /verbosity:minimal /m'
|
||
- *hashBuild
|
||
- *nexusUpload
|
||
needs: ["SOUR:Build"] |