diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..985e6df --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,153 @@ +variables: + NUGET_PATH: 'C:\Tools\nuget.exe' + MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe' + ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools' + NEXUS_PATH: 'WebSCR/WebSCR' + APP_NAME: 'WebSCR' + SOL_NAME: 'WebSCR' + VERS_MAIN: '1.2' + NEW_REL: '' + OUTPUT_DIR: '' + +# helper x fix pacchetti nuget da repo locale nexus.steamware.net +.nuget-fix: &nuget-fix + - | + $hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C + if ($hasSource -eq 0) { + C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`"" + } else { + C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`"" + } + echo $hasSource + +# helper x fix version number +.version-fix: &version-fix + - | + $env:NEW_REL = $env:VERS_MAIN+"."+(get-date –format yyMM)+"."+$CI_PIPELINE_IID + $contenuto = Get-Content -path 'VersGen\VersGen.cs' -Raw + $newContenuto = $contenuto -replace '0.0.0.0', $env:NEW_REL + $newContenuto | Set-Content -Path 'VersGen\VersGen.cs' + echo "Set vers: $env:NEW_REL" + +# helper pulizia files zip +.cleanup-zip: &cleanup-zip + - | + $env:OUTPUT_DIR = "Releases\" + $CI_COMMIT_BRANCH + "\*" + if ((Test-Path $env:OUTPUT_DIR)) + { + Remove-Item $env:OUTPUT_DIR -Force -Recurse -ErrorAction Ignore + } + echo "Clening ZIP dir: $env:OUTPUT_DIR" + +# helper creazione files zip +.zipper: &zipper + - | + $7zipPath = $env:ProgramFiles+"\7-Zip\7z.exe" + if (-not (Test-Path -Path $7zipPath -PathType Leaf)) { + throw "7 zip file '$7zipPath' not found" + } + Set-Alias 7zip $7zipPath + $Target = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip" + $Source = "$env:APP_NAME\bin\*" + 7zip a -tzip $Target $Source + echo "called ZIP $Source --> $Target" + +# 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 + $currentDate = get-date -format yyMM; + $currentTime = get-date -format ddHH; + $VersNumb = $env:NEW_REL + echo "Curr Version: $VersNumb" + $FileManIn="VersGen\manifest.xml" + $FileManOut=$env:APP_NAME +"\Resources\manifest.xml" + $FileCLogIn="VersGen\ChangeLog.html" + $FileCLogOut=$env:APP_NAME +"\Resources\ChangeLog.html" + echo "Manifest path: $FileManOut" + echo "ChangeLog path: $FileCLogOut" + + if($CI_COMMIT_BRANCH -eq "master") + { + $version = "stable" + } + else + { + $version = "unstable" + } + $manData = Get-Content $FileManIn + $manData = $manData -replace "1.0.0.0", $VersNumb + $manData = $manData -replace "{{DIRNAME}}", $env:NEXUS_PATH + $manData = $manData -replace "{{BRANCHNAME}}", "$version/LAST" + $manData = $manData -replace "{{PACKNAME}}", $env:APP_NAME + Set-Content -Path $FileManOut -Value $manData + $clogData = Get-Content $FileCLogIn + $clogData = $clogData -replace "{{CURRENT-REL}}", $VersNumb + Set-Content -Path $FileCLogOut -Value $clogData + $File2Send = Get-ChildItem("Releases\$CI_COMMIT_BRANCH\*") + ForEach ($File in $File2Send) { + $FileName = Split-Path $File -leaf + echo "mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName" + mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName + echo "mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName" + mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName + } + echo "mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $FileManOut https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml" + mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $FileManOut https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml + echo "mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $FileCLogOut https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/ChangeLog.html" + mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $FileCLogOut https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/ChangeLog.html + +# $File2Send = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip" +# mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$CI_COMMIT_BRANCH/LAST/$env:APP_NAME-$version.zip +# mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$CI_COMMIT_BRANCH/ARCHIVE/$VersNumb/$env:APP_NAME-$version.zip +# mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send".md5" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip".md5 +# mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send".sha1" https://nexus.steamware.net/repository/SWS/$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 + - deploy + +PUB:Build: + stage: build + tags: + - win + #variables: + # - APP_NAME: 'PUB' + before_script: + - *nuget-fix + - '& "$env:NUGET_PATH" restore $env:SOL_NAME.sln' # path alla solution corrente + - *version-fix + script: + - '& "$env:MSBUILD_PATH" $env:APP_NAME\$env:APP_NAME.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m' + +PUB:Deploy: + stage: deploy + tags: + - win + before_script: + - *nuget-fix + - '& "$env:NUGET_PATH" restore $env:SOL_NAME.sln' # path alla solution corrente + - *version-fix + - *cleanup-zip + script: + - '& "$env:MSBUILD_PATH" $env:APP_NAME\$env:APP_NAME.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m' + - *zipper + - *hashBuild + - *nexusUpload + needs: ["PUB:Build"] \ No newline at end of file diff --git a/VersGen/ChangeLog.html b/VersGen/ChangeLog.html new file mode 100644 index 0000000..7819710 --- /dev/null +++ b/VersGen/ChangeLog.html @@ -0,0 +1,44 @@ + + Server gestione Scehde di Collaudo +

Versione: {{CURRENT-REL}}

+
+ Note di rilascio: + +
+
+ +
+
+ © Steamware 2006-2018 +
+
+ + \ No newline at end of file diff --git a/VersGen/logoSteamware.png b/VersGen/logoSteamware.png new file mode 100644 index 0000000..0958b50 Binary files /dev/null and b/VersGen/logoSteamware.png differ diff --git a/VersGen/manifest.xml b/VersGen/manifest.xml new file mode 100644 index 0000000..d83da9d --- /dev/null +++ b/VersGen/manifest.xml @@ -0,0 +1,7 @@ + + + 1.0.0.0 + http://seriate.steamware.net:8083/SWS/CMS_SC/{{PACKNAME}}/{{BRANCHNAME}}/{{PACKNAME}}.zip + http://seriate.steamware.net:8083/SWS/CMS_SC/{{PACKNAME}}/{{BRANCHNAME}}/ChangeLog.html + false + \ No newline at end of file diff --git a/WebSCR/Resources/ChangeLog.html b/WebSCR/Resources/ChangeLog.html new file mode 100644 index 0000000..7819710 --- /dev/null +++ b/WebSCR/Resources/ChangeLog.html @@ -0,0 +1,44 @@ + + Server gestione Scehde di Collaudo +

Versione: {{CURRENT-REL}}

+
+ Note di rilascio: + +
+
+ +
+
+ © Steamware 2006-2018 +
+
+ + \ No newline at end of file diff --git a/WebSCR/Resources/logoSteamware.png b/WebSCR/Resources/logoSteamware.png new file mode 100644 index 0000000..0958b50 Binary files /dev/null and b/WebSCR/Resources/logoSteamware.png differ diff --git a/WebSCR/Resources/manifest.xml b/WebSCR/Resources/manifest.xml new file mode 100644 index 0000000..d83da9d --- /dev/null +++ b/WebSCR/Resources/manifest.xml @@ -0,0 +1,7 @@ + + + 1.0.0.0 + http://seriate.steamware.net:8083/SWS/CMS_SC/{{PACKNAME}}/{{BRANCHNAME}}/{{PACKNAME}}.zip + http://seriate.steamware.net:8083/SWS/CMS_SC/{{PACKNAME}}/{{BRANCHNAME}}/ChangeLog.html + false + \ No newline at end of file