diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dc6bf376..084bac15 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,8 +4,10 @@ variables: # ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools' # EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\GPW\Release' # DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds' - VERS_MAIN: '1.0' - NEW_REL: '' +# VERS_MAIN: '1.0' +# NEW_REL: '' + NEXUS_PATH: 'MP-STATS' + APP_NAME: 'MP.Stats' # helper x fix pacchetti nuget da repo locale nexus.steamware.net .nuget-fix: &nuget-fix @@ -18,14 +20,46 @@ variables: } echo $hasSource +# helper creazione hash files +.hashBuild: &hashBuild + - | + $Target = "Releases\" + $CI_COMMIT_BRANCH + "\" + $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 + if($CI_COMMIT_BRANCH -eq "master") + { + $version = "stable" + } + else + { + $version = "unstable" + } + $File2Send = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip" + mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send http://nexus.steamware.net/repository/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip + mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send".md5" http://nexus.steamware.net/repository/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip".md5" + mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send".sha1" http://nexus.steamware.net/repository/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip".sha1" + + +# 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 - staging - deploy - - release - installer + - release build: stage: build @@ -67,11 +101,29 @@ staging: - dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true MP.Stats/MP.Stats.csproj - dotnet publish -p:PublishProfile=W2019-IIS-DEVProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true MP.Stats/MP.Stats.csproj +staging: + stage: installer + only: + - develop + - master + needs: ["build"] + # before_script: + # - *nuget-fix + # - dotnet restore + script: + - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -c Release -o ./Releases/ $CI_COMMIT_BRANCH MP.Stats/MP.Stats.csproj + # da fare qui il deploy su nexus... + - *hashBuild + - *nexusUpload + release: stage: release only: #- feature/Deploy_CI_CD - - master + # - master + - tags + except: + - branches needs: ["build"] artifacts: paths: @@ -79,16 +131,4 @@ release: script: - dotnet publish -c Release -o ./publish MP.Stats/MP.Stats.csproj -staging: - stage: installer - only: - - master - needs: ["build"] - # before_script: - # - *nuget-fix - # - dotnet restore - script: - - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true MP.Stats/MP.Stats.csproj - # da fare qui il deploy su nexus... -