diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 591fdf87..cd547423 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: '' +# NEW_REL: '' + VERS_MAIN: '1.0' + NEXUS_PATH: 'MP-STATS' + APP_NAME: 'MP.Stats' # helper x fix pacchetti nuget da repo locale nexus.steamware.net .nuget-fix: &nuget-fix @@ -17,15 +19,55 @@ variables: C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`"" } echo $hasSource + +# helper creazione hash files +.hashBuild: &hashBuild + - | + $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" + 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 "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 http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/$FileName + mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/$VersNumb/$FileName + } + mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/manifest.xml + mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/ChangeLog.html + + +# 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 @@ -47,7 +89,7 @@ staging: stage: staging only: - develop - needs: ["build"] + needs: ["test"] # before_script: # - *nuget-fix # - dotnet restore @@ -59,7 +101,7 @@ staging: stage: deploy only: - master - needs: ["build"] + needs: ["test"] # before_script: # - *nuget-fix # - dotnet restore @@ -67,12 +109,34 @@ 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: ["test"] + before_script: + # - *nuget-fix + # - dotnet restore + # - '& "$env:NUGET_PATH" restore LPA.sln' # path alla solution corrente + # - *version-fix + # - *cleanup-zip + script: + - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release MP.Stats/MP.Stats.csproj + # da fare qui il deploy su nexus... + # - *zipper + - *hashBuild + - *nexusUpload + release: stage: release only: #- feature/Deploy_CI_CD - - master - needs: ["build"] + # - master + - tags + except: + - branches + needs: ["test"] artifacts: paths: - publish/ @@ -80,23 +144,3 @@ release: - dotnet publish -c Release -o ./publish MP.Stats/MP.Stats.csproj - -# AC:install: -# stage: installer -# rules: -# - if: '$CI_COMMIT_BRANCH == "master"' -# when: manual -# # only: -# # - tags # the build process will only be started by git tag commits -# before_script: -# - *nuget-fix -# - '& "$env:NUGET_PATH" restore GPW.sln' -# - *version-fix -# script: -# # Admin ZIP package -# - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=SPS /p:PublishProfile=SPS.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SPS_PROD/$env:NEW_REL/GPW_Admin.zip /p:DeployIisAppPath="Default Web Site/GPW/ADMIN" /p:PackageAsSingleFile=True /p:OutputPath=bin/ GPW_Admin/GPW_Admin.csproj' -# # Commesse ZIP package -# - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=SPS /p:PublishProfile=SPS.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SPS_PROD/$env:NEW_REL/GPW_Commesse.zip /p:DeployIisAppPath="Default Web Site/GPW/ADMIN" /p:PackageAsSingleFile=True /p:OutputPath=bin/ GPW_Commesse/GPW_Commesse.csproj' -# needs: ["AC:build"] - - diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj index e9250fe8..620b24cf 100644 --- a/MP.Stats/MP.Stats.csproj +++ b/MP.Stats/MP.Stats.csproj @@ -4,7 +4,7 @@ net5.0 MP.Stats 826e877c-ba70-4253-84cb-d0b1cafd4440 - 1.0.2105.2620 + 1.0.2105.2714 diff --git a/MP.Stats/Properties/PublishProfiles/IISProfile.pubxml.user b/MP.Stats/Properties/PublishProfiles/IISProfile.pubxml.user index 2a7c708a..105ac0ab 100644 --- a/MP.Stats/Properties/PublishProfiles/IISProfile.pubxml.user +++ b/MP.Stats/Properties/PublishProfiles/IISProfile.pubxml.user @@ -6,6 +6,6 @@ by editing this MSBuild file. In order to learn more about this please visit htt - True|2021-05-26T17:51:13.5051479Z;True|2021-05-26T19:51:04.9283608+02:00;True|2021-05-25T16:38:26.4142377+02:00; + True|2021-05-27T09:13:55.8234781Z;True|2021-05-26T19:51:13.5051479+02:00;True|2021-05-26T19:51:04.9283608+02:00;True|2021-05-25T16:38:26.4142377+02:00; \ No newline at end of file diff --git a/MP.Stats/post-build.ps1 b/MP.Stats/post-build.ps1 index dc0fc8e1..cf74cbc8 100644 --- a/MP.Stats/post-build.ps1 +++ b/MP.Stats/post-build.ps1 @@ -1,11 +1,34 @@ param([string]$ProjectDir, [string]$ProjectPath); +$FileVers="..\Resources\VersNum.txt" +$FileManIn="..\Resources\manifest-original.xml" +$FileManOut="..\Resources\manifest.xml" +$FileCLogIn="..\Resources\ChangeLog-original.html" +$FileCLogOut="..\Resources\ChangeLog.html" $MajMin="1.0." $currentDate = get-date -format yyMM; $currentTime = get-date -format ddHH; $find = "(.|\n)*?"; +$currRelNum=$MajMin + $currentDate +"." + $currentTime $replace = "" + $MajMin + $currentDate +"." + $currentTime + ""; $csproj = Get-Content $ProjectPath $csprojUpdated = $csproj -replace $find, $replace -Set-Content -Path $ProjectPath -Value $csprojUpdated \ No newline at end of file +Set-Content -Path $ProjectPath -Value $csprojUpdated +Set-Content -Path $FileVers -Value $currRelNum + +# replace x manifest +$manData = Get-Content $FileManIn +$manData = $manData -replace "1.0.0.0", $currRelNum +$manData = $manData -replace "{{DIRNAME}}", "MP-STATS" +$manData = $manData -replace "{{BRANCHNAME}}", "stable/0" +$manData = $manData -replace "{{PACKNAME}}", "MP.Stats" +Set-Content -Path $FileManOut -Value $manData + +# replace x ChangeLog +$clogData = Get-Content $FileCLogIn +$clogData = $clogData -replace "{{CURRENT-REL}}", $currRelNum +# $clogData = $clogData -replace "{{DIRNAME}}", "MP-STATS" +# $clogData = $clogData -replace "{{BRANCHNAME}}", "stable" +# $clogData = $clogData -replace "{{PACKNAME}}", "MP.Stats" +Set-Content -Path $FileCLogOut -Value $clogData diff --git a/Resources/ChangeLog-original.html b/Resources/ChangeLog-original.html new file mode 100644 index 00000000..9d23cb37 --- /dev/null +++ b/Resources/ChangeLog-original.html @@ -0,0 +1,27 @@ + + Modulo statistiche MAPO +

Versione: {{CURRENT-REL}}

+
+ Note di rilascio: + +
+
+ +
+
+ © Steamware 2006-2021 +
+
+ \ No newline at end of file diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html new file mode 100644 index 00000000..84026b93 --- /dev/null +++ b/Resources/ChangeLog.html @@ -0,0 +1,27 @@ + + Modulo statistiche MAPO +

Versione: 1.0.2105.2714

+
+ Note di rilascio: + +
+
+ +
+
+ © Steamware 2006-2021 +
+
+ diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt new file mode 100644 index 00000000..ca995bc1 --- /dev/null +++ b/Resources/VersNum.txt @@ -0,0 +1 @@ +1.0.2105.2714 diff --git a/Resources/logoSteamware.png b/Resources/logoSteamware.png new file mode 100644 index 00000000..0958b50a Binary files /dev/null and b/Resources/logoSteamware.png differ diff --git a/Resources/manifest-original.xml b/Resources/manifest-original.xml new file mode 100644 index 00000000..a9269ca9 --- /dev/null +++ b/Resources/manifest-original.xml @@ -0,0 +1,7 @@ + + + 1.0.0.0 + http://nexus.steamware.net/repository/SWS/{{DIRNAME}}/{{BRANCHNAME}}/{{PACKNAME}}.zip + http://nexus.steamware.net/repository/SWS/{{DIRNAME}}/{{BRANCHNAME}}/ChangeLog.html + false + diff --git a/Resources/manifest.xml b/Resources/manifest.xml new file mode 100644 index 00000000..540ddb44 --- /dev/null +++ b/Resources/manifest.xml @@ -0,0 +1,7 @@ + + + 1.0.2105.2714 + http://nexus.steamware.net/repository/SWS/MP-STATS/stable/0/MP.Stats.zip + http://nexus.steamware.net/repository/SWS/MP-STATS/stable/0/ChangeLog.html + false +