update pipeline versioning

This commit is contained in:
RaidMax 2020-10-24 21:59:10 -05:00
parent 3f7372e780
commit 98ee997bf3
6 changed files with 53 additions and 232 deletions

View File

@ -1,8 +1,11 @@
name: '$(Date:yyyy.MM.dd)$(Rev:.r)'
trigger: trigger:
batch: true batch: true
branches: branches:
include: include:
- release/pre - release/pre
- master
pr: none pr: none
@ -12,110 +15,130 @@ pool:
variables: variables:
solution: 'IW4MAdmin.sln' solution: 'IW4MAdmin.sln'
buildPlatform: 'Any CPU' buildPlatform: 'Any CPU'
buildConfiguration: 'Prerelease'
outputFolder: '$(Build.ArtifactStagingDirectory)\Publish\$(buildConfiguration)' outputFolder: '$(Build.ArtifactStagingDirectory)\Publish\$(buildConfiguration)'
releaseType: verified
buildConfiguration: Stable
steps: steps:
- task: NuGetToolInstaller@1 - task: PowerShell@2
displayName: 'Setup Pre-Release configuration'
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release/pre')
inputs:
targetType: 'inline'
script: |
echo '##vso[task.setvariable variable=releaseType]prerelease'
echo '##vso[task.setvariable variable=buildConfiguration]Prerelease'
failOnStderr: true
- task: NuGetCommand@2 - task: NuGetCommand@2
displayName: 'Restore nuget packages'
inputs: inputs:
restoreSolution: '$(solution)' restoreSolution: '$(solution)'
- task: PowerShell@2 - task: PowerShell@2
displayName: 'Preload external resources'
inputs: inputs:
targetType: 'inline' targetType: 'inline'
script: | script: |
Write-Host 'Build Configuration is $(buildConfiguration), Release Type is $(releaseType)'
md -Force lib\open-iconic\font\css md -Force lib\open-iconic\font\css
wget https://raw.githubusercontent.com/iconic/open-iconic/master/font/css/open-iconic-bootstrap.scss -o lib\open-iconic\font\css\open-iconic-bootstrap.scss wget https://raw.githubusercontent.com/iconic/open-iconic/master/font/css/open-iconic-bootstrap.scss -o lib\open-iconic\font\css\open-iconic-bootstrap.scss
failOnStderr: true failOnStderr: true
workingDirectory: '$(Build.Repository.LocalPath)\WebfrontCore\wwwroot' workingDirectory: '$(Build.Repository.LocalPath)\WebfrontCore\wwwroot'
- task: projectversionasvariable@1
inputs:
path: '$(Build.Repository.LocalPath)\Application\Application.csproj'
- task: VSBuild@1 - task: VSBuild@1
displayName: 'Build projects'
inputs: inputs:
solution: '$(solution)' solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=false /p:PackageAsSingleFile=false /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)" /p:Version=$(Version.Major).$(Version.Minor).$(Version.Build).$(Build.BuildId)' msbuildArgs: '/p:DeployOnBuild=false /p:PackageAsSingleFile=false /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)" /p:Version=$(Build.BuildNumber)'
platform: '$(buildPlatform)' platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)' configuration: '$(buildConfiguration)'
- task: DotNetCoreCLI@2 - task: DotNetCoreCLI@2
displayName: 'Publish projects'
inputs: inputs:
command: 'publish' command: 'publish'
publishWebProjects: false publishWebProjects: false
projects: | projects: |
**/WebfrontCore.csproj **/WebfrontCore.csproj
**/Application.csproj **/Application.csproj
arguments: '-c $(buildConfiguration) -o $(outputFolder) /p:Version=$(Version.Major).$(Version.Minor).$(Version.Build).$(Build.BuildId)' arguments: '-c $(buildConfiguration) -o $(outputFolder) /p:Version=$(Build.BuildNumber)'
zipAfterPublish: false zipAfterPublish: false
modifyOutputPath: false modifyOutputPath: false
- task: PowerShell@2 - task: PowerShell@2
displayName: 'Run publish script 1'
inputs: inputs:
targetType: 'inline' filePath: 'DeploymentFiles/PostPublish.ps1'
script: 'wget https://raidmax.org/downloads/dos2unix.exe'
failOnStderr: true
workingDirectory: '$(Build.Repository.LocalPath)\Application\BuildScripts'
- task: PowerShell@2
inputs:
filePath: 'PostPublish.ps1'
arguments: '$(outputFolder)' arguments: '$(outputFolder)'
failOnStderr: true failOnStderr: true
workingDirectory: '$(Build.Repository.LocalPath)' workingDirectory: '$(Build.Repository.LocalPath)'
- task: BatchScript@1 - task: BatchScript@1
displayName: 'Run publish script 2'
inputs: inputs:
filename: 'Application\BuildScripts\PostPublish.bat' filename: 'Application\BuildScripts\PostPublish.bat'
workingFolder: '$(Build.Repository.LocalPath)' workingFolder: '$(Build.Repository.LocalPath)'
arguments: '$(outputFolder)' arguments: '$(outputFolder)'
failOnStandardError: true failOnStandardError: true
- task: PowerShell@2
displayName: 'Download dos2unix for line endings'
inputs:
targetType: 'inline'
script: 'wget https://raidmax.org/downloads/dos2unix.exe'
failOnStderr: true
workingDirectory: '$(Build.Repository.LocalPath)\Application\BuildScripts'
- task: CmdLine@2 - task: CmdLine@2
displayName: 'Convert Linux start script line endings'
inputs: inputs:
script: | script: |
echo changing to encoding for linux start script echo changing to encoding for linux start script
dos2unix $(outputFolder)\StartIW4MAdmin.sh dos2unix $(outputFolder)\StartIW4MAdmin.sh
echo creating website version filename echo creating website version filename
@echo IW4MAdmin-$(Version.Major).$(Version.Minor)-$(buildConfiguration)$(Version.Build)b$(Build.BuildId) > $(Build.ArtifactStagingDirectory)\version_prerelease.txt @echo IW4MAdmin-$(Build.BuildNumber) > $(Build.ArtifactStagingDirectory)\version_$(releaseType).txt
workingDirectory: '$(Build.Repository.LocalPath)\Application\BuildScripts' workingDirectory: '$(Build.Repository.LocalPath)\Application\BuildScripts'
- task: CopyFiles@2 - task: CopyFiles@2
displayName: 'Move script plugins into publish directory'
inputs: inputs:
SourceFolder: '$(Build.Repository.LocalPath)\Plugins\ScriptPlugins' SourceFolder: '$(Build.Repository.LocalPath)\Plugins\ScriptPlugins'
Contents: '*.js' Contents: '*.js'
TargetFolder: '$(outputFolder)\Plugins' TargetFolder: '$(outputFolder)\Plugins'
- task: CopyFiles@2 - task: CopyFiles@2
displayName: 'Move binary plugins into publish directory'
inputs: inputs:
SourceFolder: '$(Build.Repository.LocalPath)\BUILD\Plugins\' SourceFolder: '$(Build.Repository.LocalPath)\BUILD\Plugins\'
Contents: '*.dll' Contents: '*.dll'
TargetFolder: '$(outputFolder)\Plugins' TargetFolder: '$(outputFolder)\Plugins'
- task: CmdLine@2 - task: CmdLine@2
displayName: 'Move webfront resources into publish directory'
inputs: inputs:
script: 'xcopy /s /y /f wwwroot $(outputFolder)\wwwroot' script: 'xcopy /s /y /f wwwroot $(outputFolder)\wwwroot'
workingDirectory: '$(Build.Repository.LocalPath)\BUILD\Plugins' workingDirectory: '$(Build.Repository.LocalPath)\BUILD\Plugins'
failOnStderr: true failOnStderr: true
- task: CmdLine@2 - task: CmdLine@2
displayName: 'Move gamescript files into publish directory'
inputs: inputs:
script: 'echo d | xcopy /s /y /f GameFiles $(outputFolder)\GameFiles' script: 'echo d | xcopy /s /y /f GameFiles $(outputFolder)\GameFiles'
workingDirectory: '$(Build.Repository.LocalPath)' workingDirectory: '$(Build.Repository.LocalPath)'
failOnStderr: true failOnStderr: true
- task: ArchiveFiles@2 - task: ArchiveFiles@2
displayName: 'Generate final zip file'
inputs: inputs:
rootFolderOrFile: '$(outputFolder)' rootFolderOrFile: '$(outputFolder)'
includeRootFolder: false includeRootFolder: false
archiveType: 'zip' archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/IW4MAdmin-$(Version.Major).$(Version.Minor)-$(buildConfiguration)$(Version.Build)b$(Build.BuildId).zip' archiveFile: '$(Build.ArtifactStagingDirectory)/IW4MAdmin-$(Build.BuildNumber).zip'
replaceExistingArchive: true replaceExistingArchive: true
- task: FtpUpload@2 - task: FtpUpload@2
displayName: 'Upload zip file to website'
inputs: inputs:
credentialsOption: 'inputs' credentialsOption: 'inputs'
serverUrl: '$(FTPUrl)' serverUrl: '$(FTPUrl)'
@ -130,13 +153,14 @@ steps:
trustSSL: false trustSSL: false
- task: FtpUpload@2 - task: FtpUpload@2
displayName: 'Upload version info to website'
inputs: inputs:
credentialsOption: 'inputs' credentialsOption: 'inputs'
serverUrl: '$(FTPUrl)' serverUrl: '$(FTPUrl)'
username: '$(FTPUsername)' username: '$(FTPUsername)'
password: '$(FTPPassword)' password: '$(FTPPassword)'
rootDirectory: '$(Build.ArtifactStagingDirectory)' rootDirectory: '$(Build.ArtifactStagingDirectory)'
filePatterns: 'version_prerelease.txt' filePatterns: 'version_$(releaseType).txt'
remoteDirectory: 'IW4MAdmin' remoteDirectory: 'IW4MAdmin'
clean: false clean: false
cleanContents: false cleanContents: false
@ -144,27 +168,29 @@ steps:
trustSSL: false trustSSL: false
- task: GitHubRelease@1 - task: GitHubRelease@1
displayName: 'Make GitHub release'
inputs: inputs:
gitHubConnection: 'github.com_RaidMax' gitHubConnection: 'github.com_RaidMax'
repositoryName: 'RaidMax/IW4M-Admin' repositoryName: 'RaidMax/IW4M-Admin'
action: 'create' action: 'create'
target: '$(Build.SourceVersion)' target: '$(Build.SourceVersion)'
tagSource: 'userSpecifiedTag' tagSource: 'userSpecifiedTag'
tag: '$(Version.Major).$(Version.Minor)-$(buildConfiguration)$(Version.Build)b$(Build.BuildId)' tag: '$(Build.BuildNumber)-$(releaseType)'
title: 'Version $(Version.Major).$(Version.Minor) $(buildConfiguration) Feature $(Version.Build) Build $(Build.BuildId)' title: 'IW4MAdmin $(Build.BuildNumber) ($(releaseType))'
assets: '$(Build.ArtifactStagingDirectory)/*.zip' assets: '$(Build.ArtifactStagingDirectory)/*.zip'
isPreRelease: true isPreRelease: eq(variables['Build.SourceBranch'], 'refs/heads/release/pre')
releaseNotesSource: 'inline' releaseNotesSource: 'inline'
releaseNotesInline: 'todo' releaseNotesInline: 'todo'
changeLogCompareToRelease: 'lastNonDraftRelease' changeLogCompareToRelease: 'lastNonDraftRelease'
changeLogType: 'commitBased' changeLogType: 'commitBased'
- task: PowerShell@2 - task: PowerShell@2
displayName: 'Update master version'
inputs: inputs:
targetType: 'inline' targetType: 'inline'
script: | script: |
$payload = @{ $payload = @{
'current-version-prerelease' = '$(Version.Major).$(Version.Minor).$(Version.Build).$(Build.BuildId)' 'current-version-$(releaseType)' = '$(Build.BuildNumber)'
'jwt-secret' = '$(JWTSecret)' 'jwt-secret' = '$(JWTSecret)'
} | ConvertTo-Json } | ConvertTo-Json
@ -179,7 +205,8 @@ steps:
Invoke-RestMethod @params Invoke-RestMethod @params
- task: PublishPipelineArtifact@1 - task: PublishPipelineArtifact@1
displayName: 'Publish artifact for analysis'
inputs: inputs:
targetPath: '$(outputFolder)' targetPath: '$(outputFolder)'
artifact: 'IW4MAdmin.$(buildConfiguration)' artifact: 'IW4MAdmin.$(buildConfiguration)'
publishLocation: 'pipeline' publishLocation: 'pipeline'

View File

@ -8,11 +8,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
GameFiles\IW4x\userraw\scripts\_commands.gsc = GameFiles\IW4x\userraw\scripts\_commands.gsc GameFiles\IW4x\userraw\scripts\_commands.gsc = GameFiles\IW4x\userraw\scripts\_commands.gsc
GameFiles\IW4x\userraw\scripts\_customcallbacks.gsc = GameFiles\IW4x\userraw\scripts\_customcallbacks.gsc GameFiles\IW4x\userraw\scripts\_customcallbacks.gsc = GameFiles\IW4x\userraw\scripts\_customcallbacks.gsc
PostPublish.ps1 = PostPublish.ps1 DeploymentFiles\deployment-pipeline.yml = DeploymentFiles\deployment-pipeline.yml
pre-release-pipeline.yaml = pre-release-pipeline.yaml DeploymentFiles\PostPublish.ps1 = DeploymentFiles\PostPublish.ps1
README.md = README.md README.md = README.md
RunPublishPre.cmd = RunPublishPre.cmd
RunPublishRelease.cmd = RunPublishRelease.cmd
version.txt = version.txt version.txt = version.txt
EndProjectSection EndProjectSection
EndProject EndProject

View File

@ -1,7 +0,0 @@
dotnet publish WebfrontCore/WebfrontCore.csproj -c Prerelease -f netcoreapp3.0 --force -o X:\IW4MAdmin\Publish\WindowsPrerelease /p:PublishProfile=Prerelease
dotnet publish Application/Application.csproj -c Prerelease -f netcoreapp3.0 --force -o X:\IW4MAdmin\Publish\WindowsPrerelease /p:PublishProfile=Prerelease
dotnet publish GameLogServer/GameLogServer.pyproj -c Release -f netcoreapp3.0 --force -o X:\IW4MAdmin\Publish\WindowsPrerelease\GameLogServer
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
msbuild GameLogServer/GameLogServer.pyproj /p:PublishProfile=PreRelease /p:DeployOnBuild=true /p:PublishProfileRootFolder=X:\IW4MAdmin\GameLogServer\
cd "X:\IW4MAdmin\DEPLOY\"
PowerShell ".\upload_prerelease.ps1"

View File

@ -1,7 +0,0 @@
dotnet publish WebfrontCore/WebfrontCore.csproj -c Release -f netcoreapp3.0 --force -o X:\IW4MAdmin\Publish\Windows /p:PublishProfile=sTABLE
dotnet publish Application/Application.csproj -c Release -f netcoreapp3.0 --force -o X:\IW4MAdmin\Publish\Windows /p:PublishProfile=Stable
dotnet publish GameLogServer/GameLogServer.pyproj -c Release -f netcoreapp3.0 --force -o X:\IW4MAdmin\Publish\WindowsPrerelease\GameLogServer
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
msbuild GameLogServer/GameLogServer.pyproj /p:PublishProfile=Stable /p:DeployOnBuild=true /p:PublishProfileRootFolder=X:\IW4MAdmin\GameLogServer\
cd "X:\IW4MAdmin\DEPLOY\"
PowerShell ".\upload_release.ps1"

View File

@ -1,190 +0,0 @@
trigger:
batch: true
branches:
include:
- releases/*
- 2.4-pr
paths:
exclude:
- azure-pipelines.yml
- Master/*
pr: none
pool:
vmImage: 'windows-latest'
variables:
solution: 'IW4MAdmin.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Prerelease'
outputFolder: '$(Build.ArtifactStagingDirectory)\Publish\$(buildConfiguration)'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
md -Force lib\open-iconic\font\css
wget https://raw.githubusercontent.com/iconic/open-iconic/master/font/css/open-iconic-bootstrap.scss -o lib\open-iconic\font\css\open-iconic-bootstrap.scss
failOnStderr: true
workingDirectory: '$(Build.Repository.LocalPath)\WebfrontCore\wwwroot'
- task: projectversionasvariable@1
inputs:
path: '$(Build.Repository.LocalPath)\Application\Application.csproj'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=false /p:PackageAsSingleFile=false /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)" /p:Version=$(Version.Major).$(Version.Minor).$(Version.Build).$(Build.BuildId)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
publishWebProjects: false
projects: |
**/WebfrontCore.csproj
**/Application.csproj
arguments: '-c $(buildConfiguration) -o $(outputFolder) /p:Version=$(Version.Major).$(Version.Minor).$(Version.Build).$(Build.BuildId)'
zipAfterPublish: false
modifyOutputPath: false
- task: PowerShell@2
inputs:
targetType: 'inline'
script: 'wget https://raidmax.org/downloads/dos2unix.exe'
failOnStderr: true
workingDirectory: '$(Build.Repository.LocalPath)\Application\BuildScripts'
- task: PowerShell@2
inputs:
filePath: 'PostPublish.ps1'
arguments: '$(outputFolder)'
failOnStderr: true
workingDirectory: '$(Build.Repository.LocalPath)'
- task: BatchScript@1
inputs:
filename: 'Application\BuildScripts\PostPublish.bat'
workingFolder: '$(Build.Repository.LocalPath)'
arguments: '$(outputFolder)'
failOnStandardError: true
- task: CmdLine@2
inputs:
script: |
echo changing to encoding for linux start script
dos2unix $(outputFolder)\StartIW4MAdmin.sh
echo creating website version filename
@echo IW4MAdmin-$(Version.Major).$(Version.Minor)-$(buildConfiguration)$(Version.Build)b$(Build.BuildId) > $(Build.ArtifactStagingDirectory)\version_prerelease.txt
workingDirectory: '$(Build.Repository.LocalPath)\Application\BuildScripts'
- task: CopyFiles@2
inputs:
SourceFolder: '$(Build.Repository.LocalPath)\Plugins\ScriptPlugins'
Contents: '*.js'
TargetFolder: '$(outputFolder)\Plugins'
- task: CopyFiles@2
inputs:
SourceFolder: '$(Build.Repository.LocalPath)\BUILD\Plugins\'
Contents: '*.dll'
TargetFolder: '$(outputFolder)\Plugins'
- task: CmdLine@2
inputs:
script: 'xcopy /s /y /f wwwroot $(outputFolder)\wwwroot'
workingDirectory: '$(Build.Repository.LocalPath)\BUILD\Plugins'
failOnStderr: true
- task: CmdLine@2
inputs:
script: 'echo d | xcopy /s /y /f GameFiles $(outputFolder)\GameFiles'
workingDirectory: '$(Build.Repository.LocalPath)'
failOnStderr: true
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(outputFolder)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/IW4MAdmin-$(Version.Major).$(Version.Minor)-$(buildConfiguration)$(Version.Build)b$(Build.BuildId).zip'
replaceExistingArchive: true
- task: FtpUpload@2
inputs:
credentialsOption: 'inputs'
serverUrl: '$(FTPUrl)'
username: '$(FTPUsername)'
password: '$(FTPPassword)'
rootDirectory: '$(Build.ArtifactStagingDirectory)'
filePatterns: '*.zip'
remoteDirectory: 'IW4MAdmin/Download'
clean: false
cleanContents: false
preservePaths: false
trustSSL: false
- task: FtpUpload@2
inputs:
credentialsOption: 'inputs'
serverUrl: '$(FTPUrl)'
username: '$(FTPUsername)'
password: '$(FTPPassword)'
rootDirectory: '$(Build.ArtifactStagingDirectory)'
filePatterns: 'version_prerelease.txt'
remoteDirectory: 'IW4MAdmin'
clean: false
cleanContents: false
preservePaths: false
trustSSL: false
- task: GitHubRelease@1
inputs:
gitHubConnection: 'github.com_RaidMax'
repositoryName: 'RaidMax/IW4M-Admin'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'userSpecifiedTag'
tag: '$(Version.Major).$(Version.Minor)-$(buildConfiguration)$(Version.Build)b$(Build.BuildId)'
title: 'Version $(Version.Major).$(Version.Minor) $(buildConfiguration) Feature $(Version.Build) Build $(Build.BuildId)'
assets: '$(Build.ArtifactStagingDirectory)/*.zip'
isPreRelease: true
releaseNotesSource: 'inline'
releaseNotesInline: 'todo'
changeLogCompareToRelease: 'lastNonDraftRelease'
changeLogType: 'commitBased'
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
$payload = @{
'current-version-prerelease' = '$(Version.Major).$(Version.Minor).$(Version.Build).$(Build.BuildId)'
'jwt-secret' = '$(JWTSecret)'
} | ConvertTo-Json
$params = @{
Uri = 'http://api.raidmax.org:5000/version'
Method = 'POST'
Body = $payload
ContentType = 'application/json'
}
Invoke-RestMethod @params
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(outputFolder)'
artifact: 'IW4MAdmin.$(buildConfiguration)'
publishLocation: 'pipeline'