131 lines
4.7 KiB
YAML
131 lines
4.7 KiB
YAML
variables:
|
||
VERS_MAIN: '0.9'
|
||
NEW_REL: ''
|
||
NUM_REL: '0.1.2.3'
|
||
NUM_DEB: '0.1.2-beta.3'
|
||
APP_NAME: 'Egw.Core.Razor.Comp'
|
||
SOL_NAME: 'Egw.Core.Razor.Comp'
|
||
NUGET_PATH: 'C:\Tools\nuget.exe'
|
||
NEW_COPYRIGHT: 'EgalWare 2022+'
|
||
|
||
# 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 viaDante16 --store-password-in-clear-text
|
||
echo "Steamware Nexus Source added"
|
||
|
||
# helper x fix version number
|
||
.version-fix: &version-fix
|
||
- |
|
||
$env:NEW_REL = $env:VERS_MAIN+"."+(get-date –format yyMM)+"."+(get-date –format ddHH)
|
||
$env:NUM_REL = $env:VERS_MAIN+"."+(get-date –format yyMM)+"."+(get-date –format dHH)
|
||
$env:NUM_DEB = $env:VERS_MAIN+"."+(get-date –format yyMM)+"-beta."+(get-date –format dHH)
|
||
$env:NEW_COPYRIGHT = "EgalWare @ 2022-" + (get-date -format yyyy)
|
||
# display versioni generate
|
||
$resoconto = "Effettuato calcolo versioni | release v: " + $env:NUM_REL + " | debug v: " + $env:NUM_DEB;
|
||
Write-Output $resoconto;
|
||
echo "VersionFix done"
|
||
|
||
# helper x fix nuspec file
|
||
.nuspec-fix: &nuspec-fix
|
||
- |
|
||
echo "Modifica dati file nuspec Release"
|
||
$currRelease = $env:NUM_REL
|
||
$currDebug = $env:NUM_DEB
|
||
$currCopy = $env:NEW_COPYRIGHT
|
||
$fileNameRel = "$env:APP_NAME/$env:APP_NAME.csproj";
|
||
$nuspDataRel = Get-Content $fileNameRel;
|
||
$findVers = "<version>(.|\n)*?</version>";
|
||
$replVers = "<version>" + $currRelease + "</version>";
|
||
$nuspDataRelUpd = $nuspDataRel -replace $findVers, $replVers;
|
||
$findCopy = "<copyright>(.|\n)*?</copyright>";
|
||
$replCopy = "<copyright>" + $currCopy + "</copyright>";
|
||
$nuspDataRelUpd = $nuspDataRelUpd -replace $findCopy, $replCopy;
|
||
$findRel = "<releaseNotes>(.|\n)*?</releaseNotes>";
|
||
$replRel = "<releaseNotes>Build " + $currRelease + "</releaseNotes>";
|
||
$nuspDataRelUpd = $nuspDataRelUpd -replace $findRel, $replRel;
|
||
Set-Content -Path $fileNameRel -Value $nuspDataRelUpd;
|
||
echo "Modifica dati file progetto x nuspec"
|
||
|
||
|
||
stages:
|
||
- build
|
||
- staging
|
||
- deploy
|
||
- release
|
||
|
||
|
||
# ---------- BUILD ----------
|
||
Egw.Core.Razor.Comp:build:
|
||
stage: build
|
||
tags:
|
||
- win
|
||
variables:
|
||
APP_NAME: Egw.Core.Razor.Comp
|
||
SOL_NAME: Egw.Core.Razor.Comp
|
||
before_script:
|
||
- *nuget-fix
|
||
- dotnet restore "$env:SOL_NAME.sln"
|
||
script:
|
||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||
|
||
# ---------- Upload Debug/Unstable ----------
|
||
Egw.Core.Razor.Comp:staging:
|
||
stage: staging
|
||
tags:
|
||
- win
|
||
variables:
|
||
APP_NAME: Egw.Core.Razor.Comp
|
||
SOL_NAME: Egw.Core.Razor.Comp
|
||
only:
|
||
- develop
|
||
needs: ["Egw.Core.Razor.Comp:build"]
|
||
before_script:
|
||
- *nuget-fix
|
||
- dotnet restore "$env:SOL_NAME.sln"
|
||
- *version-fix
|
||
- *nuspec-fix
|
||
script:
|
||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||
- dotnet pack -p:Configuration=Debug -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
|
||
- '& "$env:NUGET_PATH" setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-hosted'
|
||
- '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
|
||
|
||
# ---------- RELEASE ----------
|
||
Egw.Core.Razor.Comp:release:
|
||
stage: release
|
||
tags:
|
||
- win
|
||
variables:
|
||
APP_NAME: Egw.Core.Razor.Comp
|
||
SOL_NAME: Egw.Core.Razor.Comp
|
||
only:
|
||
- main
|
||
except:
|
||
- branches
|
||
needs: ["Egw.Core.Razor.Comp:build"]
|
||
before_script:
|
||
- *nuget-fix
|
||
- dotnet restore "$env:SOL_NAME.sln"
|
||
- *version-fix
|
||
- *nuspec-fix
|
||
script:
|
||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||
- dotnet pack -p:Configuration=Release -p:verbosity=quiet $env:APP_NAME/$env:APP_NAME.csproj
|
||
- '& "$env:NUGET_PATH" setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-hosted'
|
||
- '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
|
||
|