From 08aa8be54e0619e40701700dbfe5322dc2b628fb Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 2 Feb 2023 12:27:12 +0100 Subject: [PATCH] ancora update yaml --- .gitlab-ci.yml | 91 +++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c789416..c271356 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,12 @@ variables: - VERS_MAIN: '1.0' + 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 @@ -24,42 +28,39 @@ variables: 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 creazione hash files x IIS -.hashBuild: &hashBuild +# helper x fix version number +.version-fix: &version-fix - | - $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" + $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" - echo "Created HASH files for $Target" - -# helper x send su NEXUS x pack -.nexusUpload: &nexusUpload +# helper x fix nuspec file +.nuspec-fix: &nuspec-fix - | - Set-Alias mCurl C:\Windows\system32\curl.exe - $fileVers = $env:APP_NAME + "\Resources\VersNum.txt" - $VersNumb = Get-Content $fileVers - 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 "$env:APP_NAME\Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$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:NEXUS_PATH/$version/LAST/ChangeLog.html + 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 = "(.|\n)*?"; + $replVers = "" + $currRelease + ""; + $nuspDataRelUpd = $nuspDataRel -replace $findVers, $replVers; + $findCopy = "(.|\n)*?"; + $replCopy = "" + $currCopy + ""; + $nuspDataRelUpd = $nuspDataRelUpd -replace $findCopy, $replCopy; + $findRel = "(.|\n)*?"; + $replRel = "Build " + $currRelease + ""; + $nuspDataRelUpd = $nuspDataRelUpd -replace $findRel, $replRel; + Set-Content -Path $fileNameRel -Value $nuspDataRelUpd; + echo "Modifica dati file progetto x nuspec" + stages: - build @@ -82,7 +83,7 @@ Egw.Core.Razor.Comp:build: script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj -# ---------- STAGING ---------- +# ---------- Upload Debug/Unstable ---------- Egw.Core.Razor.Comp:staging: stage: staging tags: @@ -96,9 +97,13 @@ Egw.Core.Razor.Comp:staging: 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 publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true -p:verbosity=quiet $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: @@ -116,15 +121,11 @@ Egw.Core.Razor.Comp:release: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - artifacts: - paths: - - publish/ + - *version-fix + - *nuspec-fix script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj - - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish -p:verbosity=quiet - # qui il deploy su nexus... - - *hashBuild - - *nexusUpload - # script: - # - dotnet publish -c Release -o ./publish GPW.Egw.Core.Razor.Comp/GPW.Egw.Core.Razor.Comp.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' \ No newline at end of file