variables: VERS_MAIN: '1.0' NEXUS_PATH: 'EQN/EqnSend' APP_NAME: 'Eqn.Sender' ZIP_NAME: 'EqnSender' SOL_NAME: 'Eqn.Sender' # 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 } $hasSource = dotnet nuget list source | Select-String -Pattern "nexus-hosted" if (! [String]::IsNullOrWhiteSpace($hasSource)) { dotnet nuget remove source nexus-hosted } $hasSource = dotnet nuget list source | Select-String -Pattern "Microsoft Visual Studio Offline Packages" if (! [String]::IsNullOrWhiteSpace($hasSource)) { dotnet nuget remove source 'Microsoft Visual Studio Offline Packages' } echo "Situazione sorgenti post remove:" dotnet nuget list source dotnet nuget add source https://nexus.steamware.net/repository/nuget-proxy-v3/index.json -n nexus-proxy-v3 -u nugetUser -p $NEXUS_PASSWD --store-password-in-clear-text dotnet nuget add source https://nexus.steamware.net/repository/nuget-hosted/ -n nexus-hosted -u nugetUser -p $NEXUS_PASSWD --store-password-in-clear-text $hasSource = dotnet nuget list source echo "Situazione sorgenti FINALE:" dotnet nuget list source # helper creazione hash files .hashBuild: &hashBuild - | $Target = $env:APP_NAME + "\bin\publish\" + $env:ZIP_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 "main") { $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 # 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 @ 2021-" + (get-date -format yyyy) $contenuto = Get-Content -path 'VersGen\VersGen.cs' -Raw $newContenuto = $contenuto -replace '0.0.0.0', $env:NEW_REL $newContenuto = $newContenuto -replace 'EgalWare © 2021', $env:NEW_COPYRIGHT $newContenuto | Set-Content -Path 'VersGen\VersGen.cs' # display versioni generate $resoconto = "Effettuato fix file VersGen | release v: " + $env:NUM_REL + " | debug v: " + $env:NUM_DEB; Write-Output $resoconto; echo "Replace completati" # helper x fix nuspec file .nuspec-fix: &nuspec-fix - | echo "Modifica dati file nuspec Release" $currRelease = $env:NUM_REL $currDebug = $env:NUM_DEB $find = "(.|\n)*?"; $fileNameRel = "$env:APP_NAME.Release.nuspec"; $replRel = "" + $currRelease + ""; $nuspDataRel = Get-Content $fileNameRel; $nuspDataRelUpd = $nuspDataRel -replace $find, $replRel; $nuspDataRelUpd = $nuspDataRelUpd -replace "#copyright#", $replCopy; $nuspDataRelUpd = $nuspDataRelUpd -replace "#releaseNotes#", "Build $adesso"; Set-Content -Path $fileNameRel -Value $nuspDataRelUpd; echo "Modifica dati file nuspec Debug" $fileNameDeb = "$env:APP_NAME.Debug.nuspec"; $replDeb = "" + $currDebug + ""; $nuspDataDeb = Get-Content $fileNameDeb; $nuspDataDebUpd = $nuspDataDeb -replace $find, $replDeb; $nuspDataDebUpd = $nuspDataDebUpd -replace "#copyright#", $replCopy; $nuspDataDebUpd = $nuspDataDebUpd -replace "#releaseNotes#", "Build $adesso"; Set-Content -Path $fileNameDeb -Value $nuspDataDebUpd; echo "replace completati" stages: - build - installer # -------------------------------- # BUILD # -------------------------------- EqnSender:build: stage: build tags: - win before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" script: - echo $CI_COMMIT_BRANCH - dotnet build $env:APP_NAME/$env:APP_NAME.csproj EqnSender:installer: stage: installer tags: - win only: - develop - main before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" needs: ["EqnSender:build"] script: # - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release MagMan.UI/MagMan.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 $env:APP_NAME/$env:APP_NAME.csproj -o:publish -r linux-x64 --self-contained false # qui il deploy su nexus... - *hashBuild - *nexusUpload