parameter updates

This commit is contained in:
Brett Hewitson 2022-12-22 22:22:41 +10:00
parent 6644f37d64
commit efb8585f8d

View file

@ -7,7 +7,7 @@ parameters:
default: 'src/Server-Managers.sln' default: 'src/Server-Managers.sln'
- name: ProjectFile - name: ProjectFile
type: string type: string
default: 'src/$(ApplicationName)/$(ApplicationName).csproj' default: 'src/${{parameters.ApplicationName}}/${{parameters.ApplicationName}}.csproj'
- name: BuildPlatform - name: BuildPlatform
type: string type: string
default: AnyCPU default: AnyCPU
@ -54,37 +54,37 @@ stages:
- task: NuGetCommand@2 - task: NuGetCommand@2
displayName: NuGet Restore displayName: NuGet Restore
inputs: inputs:
restoreSolution: '$(SolutionFile)' restoreSolution: '${{parameters.SolutionFile}}'
- task: PowerShell@2 - task: PowerShell@2
displayName: Apply Semantic Versioning to AssemblyInfo Files displayName: Apply Semantic Versioning to AssemblyInfo Files
inputs: inputs:
targetType: filePath targetType: filePath
filePath: './.azure/scripts/ApplySemanticVersioningToAssemblies.ps1' filePath: './.azure/scripts/ApplySemanticVersioningToAssemblies.ps1'
arguments: "-applicationName $(ApplicationName) -pathToSearch '$(Build.SourcesDirectory)/src' -buildNumber $(Build.BuildNumber) -searchFilter 'AssemblyInfo.*'" arguments: "-applicationName ${{parameters.ApplicationName}} -pathToSearch '$(Build.SourcesDirectory)/src' -buildNumber $(Build.BuildNumber) -searchFilter 'AssemblyInfo.*'"
pwsh: true pwsh: true
- task: projectfileprops@1 - task: projectfileprops@1
displayName: Modify ApplicationVersion in Project File displayName: Modify ApplicationVersion in Project File
inputs: inputs:
path: '$(ProjectFile)' path: '${{parameters.ProjectFile}}'
fieldOptions: ApplicationVersion fieldOptions: ApplicationVersion
value: '$(VersionMajor).$(VersionMinor).$(VersionBuild).%2a' value: '$(VersionMajor).$(VersionMinor).$(VersionBuild).%2a'
- task: projectfileprops@1 - task: projectfileprops@1
displayName: Modify ApplicationRevision in Project File displayName: Modify ApplicationRevision in Project File
inputs: inputs:
path: '$(ProjectFile)' path: '${{parameters.ProjectFile}}'
fieldOptions: ApplicationRevision fieldOptions: ApplicationRevision
value: '$(VersionRevision)' value: '$(VersionRevision)'
- task: VSBuild@1 - task: VSBuild@1
displayName: Build $(ApplicationName) Project displayName: Build ${{parameters.ApplicationName}} Project
inputs: inputs:
solution: '$(ProjectFile)' solution: '${{parameters.ProjectFile}}'
msbuildArgs: '/t:publish /p:PublishDir="$(Build.BinariesDirectory)"' msbuildArgs: '/t:publish /p:PublishDir="$(Build.BinariesDirectory)"'
platform: '$(BuildPlatform)' platform: '${{parameters.BuildPlatform}}'
configuration: '$(BuildConfiguration)' configuration: '${{parameters.BuildConfiguration}}'
clean: true clean: true
- task: PowerShell@2 - task: PowerShell@2
@ -105,13 +105,13 @@ stages:
# Rename application files folder # Rename application files folder
$applicationFolders = Get-ChildItem -Path "$env:BUILD_BINARIESDIRECTORY\Application Files" -Filter "*_$appVersionWithUnderscores" -Directory -Name $applicationFolders = Get-ChildItem -Path "$env:BUILD_BINARIESDIRECTORY\Application Files" -Filter "*_$appVersionWithUnderscores" -Directory -Name
$applicationFolder = $applicationFolders.Where({$_.Replace(' ', '') -eq "$(ApplicationName)_$appVersionWithUnderscores"}) $applicationFolder = $applicationFolders.Where({$_.Replace(' ', '') -eq "${{parameters.ApplicationName}}_$appVersionWithUnderscores"})
if ($applicationFolder.Count -ne 1) { if ($applicationFolder.Count -ne 1) {
throw "Could not find the application folder ($(ApplicationName)_$appVersionWithUnderscores)" throw "Could not find the application folder (${{parameters.ApplicationName}}_$appVersionWithUnderscores)"
} }
$applicationFolderName = $applicationFolder[0] $applicationFolderName = $applicationFolder[0]
Rename-Item -Path "$env:BUILD_BINARIESDIRECTORY\Application Files\$applicationFolderName" -NewName "$env:BUILD_BINARIESDIRECTORY\Application Files\$(ApplicationName)_$appVersionWithUnderscores" -Force Rename-Item -Path "$env:BUILD_BINARIESDIRECTORY\Application Files\$applicationFolderName" -NewName "$env:BUILD_BINARIESDIRECTORY\Application Files\${{parameters.ApplicationName}}_$appVersionWithUnderscores" -Force
pwsh: true pwsh: true
- task: CopyFiles@2 - task: CopyFiles@2
@ -119,9 +119,9 @@ stages:
inputs: inputs:
SourceFolder: '$(Build.SourcesDirectory)' SourceFolder: '$(Build.SourcesDirectory)'
Contents: | Contents: |
src/$(ApplicationName)/VersionFeed.xml src/${{parameters.ApplicationName}}/VersionFeed.xml
src/$(ApplicationName)/VersionFeedBeta.xml src/${{parameters.ApplicationName}}/VersionFeedBeta.xml
src/$(ApplicationName)/Globalization/en-US/en-US.xaml src/${{parameters.ApplicationName}}/Globalization/en-US/en-US.xaml
TargetFolder: '$(Build.ArtifactStagingDirectory)' TargetFolder: '$(Build.ArtifactStagingDirectory)'
OverWrite: true OverWrite: true
flattenFolders: true flattenFolders: true
@ -161,10 +161,10 @@ stages:
$appVersionShort = $appVersion.Substring(0, $appVersion.LastIndexOf('.')) $appVersionShort = $appVersion.Substring(0, $appVersion.LastIndexOf('.'))
$appVersionWithUnderscores = $appVersion.Replace('.', '_') $appVersionWithUnderscores = $appVersion.Replace('.', '_')
$installScriptFile = ".azure/scripts/$(ApplicationName).iss" $installScriptFile = ".azure/scripts/${{parameters.ApplicationName}}.iss"
$installTextFile = '.azure/scripts/Installer.txt' $installTextFile = '.azure/scripts/Installer.txt'
$sourceIconFile = "$env:BUILD_SOURCESDIRECTORY/src/$(ApplicationName)/Art/favicon.ico" $sourceIconFile = "$env:BUILD_SOURCESDIRECTORY/src/${{parameters.ApplicationName}}/Art/favicon.ico"
$destIconFile = "$env:BUILD_BINARIESDIRECTORY/favicon.ico" $destIconFile = "$env:BUILD_BINARIESDIRECTORY/favicon.ico"
Copy-Item -Path "$sourceIconFile" -Destination "$destIconFile" -Force Copy-Item -Path "$sourceIconFile" -Destination "$destIconFile" -Force
@ -190,7 +190,7 @@ stages:
script: | script: |
$appVersion = $env:BUILD_BUILDNUMBER $appVersion = $env:BUILD_BUILDNUMBER
$appVersionWithUnderscores = $appVersion.Replace('.', '_') $appVersionWithUnderscores = $appVersion.Replace('.', '_')
$applicationFolderName = "$(ApplicationName)_$($appVersionWithUnderscores)" $applicationFolderName = "${{parameters.ApplicationName}}_$($appVersionWithUnderscores)"
$sourcePath = "$env:BUILD_BINARIESDIRECTORY/Application Files/$applicationFolderName" $sourcePath = "$env:BUILD_BINARIESDIRECTORY/Application Files/$applicationFolderName"
Copy-Item -Path "$sourcePath\ServerManagerUpdater.exe" -Destination "$sourcePath\NewServerManagerUpdater.exe" -Force Copy-Item -Path "$sourcePath\ServerManagerUpdater.exe" -Destination "$sourcePath\NewServerManagerUpdater.exe" -Force
@ -208,11 +208,11 @@ stages:
$appVersion = $env:BUILD_BUILDNUMBER $appVersion = $env:BUILD_BUILDNUMBER
$appVersionShort = $appVersion.Substring(0, $appVersion.LastIndexOf('.')) $appVersionShort = $appVersion.Substring(0, $appVersion.LastIndexOf('.'))
$appVersionWithUnderscores = $appVersion.Replace('.', '_') $appVersionWithUnderscores = $appVersion.Replace('.', '_')
$applicationFolderName = "$(ApplicationName)_$($appVersionWithUnderscores)" $applicationFolderName = "${{parameters.ApplicationName}}_$($appVersionWithUnderscores)"
$sourcePath = "$env:BUILD_BINARIESDIRECTORY/Application Files/$applicationFolderName" $sourcePath = "$env:BUILD_BINARIESDIRECTORY/Application Files/$applicationFolderName"
$zipFile1 = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/latest.zip" $zipFile1 = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/latest.zip"
$zipFile2 = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/$(ApplicationName)_$($appVersionShort).zip" $zipFile2 = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY/${{parameters.ApplicationName}}_$($appVersionShort).zip"
Add-Type -Assembly System.IO.Compression.FileSystem Add-Type -Assembly System.IO.Compression.FileSystem
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal $compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
@ -226,4 +226,4 @@ stages:
enabled: true enabled: true
inputs: inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)' PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: '$(PublishFolder)' ArtifactName: '${{parameters.PublishFolder}}'