Inizio yaml
This commit is contained in:
+216
@@ -0,0 +1,216 @@
|
||||
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'
|
||||
EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\NKC\Release'
|
||||
DEPLOY_FOLDER: 'c:\Projects\Deploy\NKC\Builds'
|
||||
VERS_MAIN: '2.0'
|
||||
NEW_REL: ''
|
||||
NEXUS_PATH: 'NKC'
|
||||
PROJ_NAME: 'NKC_WF'
|
||||
APP_NAME: 'NKC'
|
||||
|
||||
|
||||
# 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 "`"viaDante16`""
|
||||
} else {
|
||||
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
|
||||
}
|
||||
echo $hasSource
|
||||
|
||||
# helper x fix version number
|
||||
.version-fix: &version-fix
|
||||
- |
|
||||
$env:NEW_REL = $env:VERS_MAIN+"."+(get-date –format yyMM)+"."+(get-date –format ddHH)
|
||||
echo "Set vers: $env:NEW_REL"
|
||||
$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'
|
||||
|
||||
# helper x fix manifest xml
|
||||
.manifest-fix: &manifest-fix
|
||||
- |
|
||||
echo "Set manifest.xml for branch: $CI_COMMIT_BRANCH"
|
||||
$contenuto = Get-Content -path $env:PROJ_NAME'\Resources\manifest.xml' -Raw
|
||||
$newContenuto = $contenuto -replace '{{BRANCHNAME}}', $CI_COMMIT_BRANCH
|
||||
$newContenuto = $newContenuto -replace '0.0.0.0', $env:NEW_REL
|
||||
$newContenuto | Set-Content -path $env:PROJ_NAME'\Resources\manifest.xml'
|
||||
|
||||
# helper creazione hash files
|
||||
.hashBuild: &hashBuild
|
||||
- |
|
||||
$Target = $env:PROJ_NAME + "\Release\" + $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
|
||||
# $VersNumb = $Get-Content "Resources\VersNum.txt"
|
||||
.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"
|
||||
if($CI_COMMIT_BRANCH -eq "master")
|
||||
{
|
||||
$version = "stable"
|
||||
}
|
||||
else
|
||||
{
|
||||
$version = "unstable"
|
||||
}
|
||||
$File2Send = Get-ChildItem($env:PROJ_NAME + "\Release\*")
|
||||
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/$CI_COMMIT_BRANCH/LAST/$FileName
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$CI_COMMIT_BRANCH/ARCHIVE/$VersNumb/$FileName
|
||||
}
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "$env:PROJ_NAME\Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$CI_COMMIT_BRANCH/LAST/manifest.xml
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "$env:PROJ_NAME\Resources\ChangeLog.html" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$CI_COMMIT_BRANCH/LAST/ChangeLog.html
|
||||
|
||||
stages:
|
||||
- build
|
||||
- deploy
|
||||
- installer
|
||||
|
||||
|
||||
Net:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore NKC_WF.sln -Verbosity quiet'
|
||||
- *version-fix
|
||||
script:
|
||||
- '& "$env:MSBUILD_PATH" NKC_WF/NKC_WF.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
|
||||
|
||||
Core:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore REMAN.sln
|
||||
script:
|
||||
- dotnet build REMAN/REMAN.csproj
|
||||
|
||||
Net:IIS01:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "develop"'
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore NKC_WF.sln -Verbosity quiet'
|
||||
- *version-fix
|
||||
script:
|
||||
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS01.pubxml /p:RunCodeAnalysis=false /p:Configuration=IIS01 /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal NKC_WF/NKC_WF.csproj'
|
||||
needs: ["Net:build"]
|
||||
|
||||
Net:IIS02:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore NKC_WF.sln -Verbosity quiet'
|
||||
- *version-fix
|
||||
script:
|
||||
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS02.pubxml /p:RunCodeAnalysis=false /p:Configuration=IIS02 /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ /verbosity:minimal NKC_WF/NKC_WF.csproj'
|
||||
needs: ["Net:build"]
|
||||
|
||||
Core:IIS01:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
only:
|
||||
- develop
|
||||
needs: ["Core:build"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true REMAN/REMAN.csproj
|
||||
|
||||
Core:IIS02:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
only:
|
||||
- master
|
||||
needs: ["Core:build"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true REMAN/REMAN.csproj
|
||||
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true REMAN/REMAN.csproj
|
||||
|
||||
|
||||
|
||||
Net:install:
|
||||
stage: installer
|
||||
tags:
|
||||
- win
|
||||
# rules:
|
||||
# - if: '$CI_COMMIT_BRANCH == "master"'
|
||||
# when: manual
|
||||
variables:
|
||||
APP_NAME: NKC
|
||||
PROJ_NAME: NKC_WF
|
||||
NEXUS_PATH: NKC
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- '& "$env:NUGET_PATH" restore NKC_WF.sln -Verbosity quiet'
|
||||
- *version-fix
|
||||
- *manifest-fix
|
||||
script:
|
||||
- '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=Release /p:PublishProfile=master.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=Release/$env:APP_NAME.zip /p:DeployIisAppPath="Default Web Site/NKC" /p:PackageAsSingleFile=True /verbosity:minimal /p:OutputPath=bin/ NKC_WF/NKC_WF.csproj'
|
||||
# qui il deploy su nexus...
|
||||
- *hashBuild
|
||||
- *nexusUpload
|
||||
needs: ["Net:build"]
|
||||
|
||||
Core:install:
|
||||
stage: installer
|
||||
tags:
|
||||
- win
|
||||
only:
|
||||
- develop
|
||||
- master
|
||||
needs: ["Core:build"]
|
||||
variables:
|
||||
APP_NAME: REMAN
|
||||
PROJ_NAME: REMAN
|
||||
NEXUS_PATH: REMAN
|
||||
before_script:
|
||||
# - *nuget-fix
|
||||
- dotnet restore REMAN.sln
|
||||
- *version-fix
|
||||
- *manifest-fix
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release REMAN/REMAN.csproj -o:publish
|
||||
# qui il deploy su nexus...
|
||||
- *hashBuild
|
||||
- *nexusUpload
|
||||
|
||||
# VARIABILI
|
||||
# Tema numero versione: si potrebbe usare la variabile CI_COMMIT_TAG con $env:CI_COMMIT_TAG, in questo caso SOLO SE c'è un tag sistema versione...
|
||||
# Tema compilazione x branch: $CI_COMMIT_BRANCH == "my-branch" potrebbe essere condizione if x fare alcuni sscript...
|
||||
# rif: https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
|
||||
|
||||
# Da approfondire:
|
||||
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/dotNET.gitlab-ci.yml
|
||||
# https://www.google.com/search?q=gitlab+variable+year+month&rlz=1C1GCEA_enIT945IT945&oq=gitlab+variable+year+month&aqs=chrome..69i57j69i64.5262j0j7&sourceid=chrome&ie=UTF-8
|
||||
# https://docs.gitlab.com/ee/ci/examples/README.html
|
||||
# https://docs.gitlab.com/ee/ci/quick_start/index.html
|
||||
# https://docs.gitlab.com/ee/ci/yaml/
|
||||
@@ -30,5 +30,5 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// È possibile specificare tutti i valori o lasciare i valori predefiniti per Revisione e Numeri build
|
||||
// utilizzando l'asterisco (*) come illustrato di seguito:
|
||||
[assembly: AssemblyVersion("1.1.1812.17")]
|
||||
[assembly: AssemblyFileVersion("1.1.1812.17")]
|
||||
[assembly: AssemblyVersion("1.1.2204.1109")]
|
||||
[assembly: AssemblyFileVersion("1.1.2204.1109")]
|
||||
|
||||
@@ -155,6 +155,9 @@
|
||||
<Content Include="Content\bootstrap-reboot.css.map" />
|
||||
<Content Include="Content\bootstrap-grid.min.css.map" />
|
||||
<Content Include="Content\bootstrap-grid.css.map" />
|
||||
<None Include="Properties\PublishProfiles\IIS03.pubxml" />
|
||||
<None Include="Properties\PublishProfiles\IIS02.pubxml" />
|
||||
<None Include="Properties\PublishProfiles\IIS01.pubxml" />
|
||||
<None Include="Properties\PublishProfiles\OVH-PROD.pubxml" />
|
||||
<Content Include="Scripts\bootstrap.bundle.js" />
|
||||
<Content Include="Scripts\bootstrap.bundle.min.js" />
|
||||
|
||||
Reference in New Issue
Block a user