mirror of
https://github.com/tribufu/ServerManagers
synced 2026-06-01 09:42:39 +00:00
pipeline file changes
This commit is contained in:
parent
6d1da1270f
commit
942fdb66d3
2 changed files with 183 additions and 143 deletions
|
|
@ -40,167 +40,149 @@ stages:
|
|||
runOnce:
|
||||
deploy:
|
||||
steps:
|
||||
- task: PowerShell@2
|
||||
displayName: Output Deployment Parameters
|
||||
condition: contains(variables['system.debug'], 'true')
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
Write-Host "DeploymentType: ${{parameters.DeploymentType}}"
|
||||
Write-Host "DependsOn: ${{parameters.DependsOn}}"
|
||||
Write-Host "ApplicationName: ${{parameters.ApplicationName}}"
|
||||
Write-Host "PublishFolder: ${{parameters.PublishFolder}}"
|
||||
Write-Host "RepositoryFolder: ${{parameters.RepositoryFolder}}"
|
||||
pwsh: true
|
||||
- task: PowerShell@2
|
||||
displayName: Output Deployment Parameters
|
||||
condition: contains(variables['system.debug'], 'true')
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
Write-Host "DeploymentType: ${{parameters.DeploymentType}}"
|
||||
Write-Host "DependsOn: ${{parameters.DependsOn}}"
|
||||
Write-Host "ApplicationName: ${{parameters.ApplicationName}}"
|
||||
Write-Host "PublishFolder: ${{parameters.PublishFolder}}"
|
||||
Write-Host "RepositoryFolder: ${{parameters.RepositoryFolder}}"
|
||||
pwsh: true
|
||||
|
||||
- template: output-environment-variables.yml@self
|
||||
- template: output-environment-variables.yml@self
|
||||
|
||||
- checkout: MasterRepo
|
||||
enabled: false
|
||||
persistCredentials: true
|
||||
- checkout: MasterRepo
|
||||
enabled: false
|
||||
persistCredentials: true
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Pull Master Repository Files
|
||||
enabled: false
|
||||
env:
|
||||
DEPLOY_BUILDNUMBER: $(Build.BuildNumber)
|
||||
DEPLOY_SOURCESDIRECTORY: $(Build.SourcesDirectory)
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
Write-Host "Setting up the global configuration"
|
||||
git config --global user.email "${{parameters.GitEmail}}"
|
||||
git config --global user.name "${{parameters.GitUsername}}"
|
||||
- task: PowerShell@2
|
||||
displayName: Pull Master Repository Files
|
||||
enabled: false
|
||||
env:
|
||||
DEPLOY_BUILDNUMBER: $(Build.BuildNumber)
|
||||
DEPLOY_SOURCESDIRECTORY: $(Build.SourcesDirectory)
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
Write-Host "Setting up the global configuration"
|
||||
git config --global user.email "${{parameters.GitEmail}}"
|
||||
git config --global user.name "${{parameters.GitUsername}}"
|
||||
|
||||
Write-Host "Performing Git Checkout"
|
||||
git checkout -b master
|
||||
Write-Host "Performing Git Checkout"
|
||||
git checkout -b master
|
||||
|
||||
Write-Host "Performing Git Fetch"
|
||||
git fetch
|
||||
Write-Host "Performing Git Fetch"
|
||||
git fetch
|
||||
|
||||
Write-Host "Performing Git Branch"
|
||||
git branch --set-upstream-to=origin/master master
|
||||
Write-Host "Performing Git Branch"
|
||||
git branch --set-upstream-to=origin/master master
|
||||
|
||||
Write-Host "Performing Git Pull"
|
||||
git pull --force
|
||||
pwsh: true
|
||||
workingDirectory: '$(Build.SourcesDirectory)'
|
||||
Write-Host "Performing Git Pull"
|
||||
git pull --force
|
||||
pwsh: true
|
||||
workingDirectory: '$(Build.SourcesDirectory)'
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Copy ${{parameters.DeploymentType}} Files
|
||||
enabled: false
|
||||
env:
|
||||
DEPLOY_BUILDNUMBER: $(Build.BuildNumber)
|
||||
DEPLOY_PUBLISHDIRECTORY: "$(Agent.BuildDirectory)/${{parameters.PublishFolder}}"
|
||||
DEPLOY_REPODIRECTORY: "$(Build.SourcesDirectory)/${{parameters.RepositoryFolder}}"
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
$appVersion = $env:DEPLOY_BUILDNUMBER
|
||||
$appVersionShort = $appVersion.Substring(0, $appVersion.LastIndexOf('.'))
|
||||
- task: PowerShell@2
|
||||
displayName: Copy ${{parameters.DeploymentType}} Files
|
||||
enabled: false
|
||||
env:
|
||||
DEPLOY_BUILDNUMBER: $(Build.BuildNumber)
|
||||
DEPLOY_PUBLISHDIRECTORY: "$(Agent.BuildDirectory)/${{parameters.PublishFolder}}"
|
||||
DEPLOY_REPODIRECTORY: "$(Build.SourcesDirectory)/${{parameters.RepositoryFolder}}"
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
$appVersion = $env:DEPLOY_BUILDNUMBER
|
||||
$appVersionShort = $appVersion.Substring(0, $appVersion.LastIndexOf('.'))
|
||||
|
||||
if (!(Test-Path $env:DEPLOY_PUBLISHDIRECTORY)) {
|
||||
throw "Source directory does not exist or could not be found ($env:DEPLOY_PUBLISHDIRECTORY)"
|
||||
}
|
||||
if (!(Test-Path $env:DEPLOY_REPODIRECTORY)) {
|
||||
New-Item -Path "$env:DEPLOY_REPODIRECTORY" -ItemType Directory -Force
|
||||
}
|
||||
if (!(Test-Path $env:DEPLOY_PUBLISHDIRECTORY)) {
|
||||
throw "Source directory does not exist or could not be found ($env:DEPLOY_PUBLISHDIRECTORY)"
|
||||
}
|
||||
if (!(Test-Path $env:DEPLOY_REPODIRECTORY)) {
|
||||
New-Item -Path "$env:DEPLOY_REPODIRECTORY" -ItemType Directory -Force
|
||||
}
|
||||
|
||||
# copy common files
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\en-US.xaml" -Destination "$env:DEPLOY_REPODIRECTORY" -Force
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\latest.zip" -Destination "$env:DEPLOY_REPODIRECTORY" -Force
|
||||
# copy common files
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\en-US.xaml" -Destination "$env:DEPLOY_REPODIRECTORY" -Force
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\latest.zip" -Destination "$env:DEPLOY_REPODIRECTORY" -Force
|
||||
|
||||
# copy beta specific files
|
||||
if ('${{parameters.DeploymentType}}' -eq 'Beta') {
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\latestBeta.txt" -Destination "$env:DEPLOY_REPODIRECTORY\latest.txt" -Force
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\VersionFeedBeta.xml" -Destination "$env:DEPLOY_REPODIRECTORY\VersionFeed.xml" -Force
|
||||
}
|
||||
# copy beta specific files
|
||||
if ('${{parameters.DeploymentType}}' -eq 'Beta') {
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\latestBeta.txt" -Destination "$env:DEPLOY_REPODIRECTORY\latest.txt" -Force
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\VersionFeedBeta.xml" -Destination "$env:DEPLOY_REPODIRECTORY\VersionFeed.xml" -Force
|
||||
}
|
||||
|
||||
# copy production specific files
|
||||
if ('${{parameters.DeploymentType}}' -eq 'Production') {
|
||||
$applicationFilenamePrefix = "${{parameters.ApplicationName}}_$appVersionShort"
|
||||
# copy production specific files
|
||||
if ('${{parameters.DeploymentType}}' -eq 'Production') {
|
||||
$applicationFilenamePrefix = "${{parameters.ApplicationName}}_$appVersionShort"
|
||||
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\$applicationFilenamePrefix.exe" -Destination "$env:DEPLOY_REPODIRECTORY" -Force
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\$applicationFilenamePrefix.zip" -Destination "$env:DEPLOY_REPODIRECTORY" -Force
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\latest.exe" -Destination "$env:DEPLOY_REPODIRECTORY" -Force
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\latest.txt" -Destination "$env:DEPLOY_REPODIRECTORY" -Force
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\VersionFeed.xml" -Destination "$env:DEPLOY_REPODIRECTORY" -Force
|
||||
}
|
||||
pwsh: true
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\$applicationFilenamePrefix.exe" -Destination "$env:DEPLOY_REPODIRECTORY" -Force
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\$applicationFilenamePrefix.zip" -Destination "$env:DEPLOY_REPODIRECTORY" -Force
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\latest.exe" -Destination "$env:DEPLOY_REPODIRECTORY" -Force
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\latest.txt" -Destination "$env:DEPLOY_REPODIRECTORY" -Force
|
||||
Copy-Item -Path "$env:DEPLOY_PUBLISHDIRECTORY\VersionFeed.xml" -Destination "$env:DEPLOY_REPODIRECTORY" -Force
|
||||
}
|
||||
pwsh: true
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Commit ${{parameters.DeploymentType}} Files
|
||||
enabled: false
|
||||
env:
|
||||
DEPLOY_BUILDNUMBER: $(Build.BuildNumber)
|
||||
DEPLOY_SOURCESDIRECTORY: $(Build.SourcesDirectory)
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
$appVersion = $env:DEPLOY_BUILDNUMBER
|
||||
$appVersionShort = $appVersion.Substring(0, $appVersion.LastIndexOf('.'))
|
||||
- task: PowerShell@2
|
||||
displayName: Commit ${{parameters.DeploymentType}} Files
|
||||
enabled: false
|
||||
env:
|
||||
DEPLOY_BUILDNUMBER: $(Build.BuildNumber)
|
||||
DEPLOY_SOURCESDIRECTORY: $(Build.SourcesDirectory)
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
$appVersion = $env:DEPLOY_BUILDNUMBER
|
||||
$appVersionShort = $appVersion.Substring(0, $appVersion.LastIndexOf('.'))
|
||||
|
||||
Write-Host "Setting up the global configuration"
|
||||
git config --global user.email "${{parameters.GitEmail}}"
|
||||
git config --global user.name "${{parameters.GitUsername}}"
|
||||
Write-Host "Setting up the global configuration"
|
||||
git config --global user.email "${{parameters.GitEmail}}"
|
||||
git config --global user.name "${{parameters.GitUsername}}"
|
||||
|
||||
Write-Host "Performing Git Add"
|
||||
git add -A
|
||||
Write-Host "Performing Git Add"
|
||||
git add -A
|
||||
|
||||
Write-Host "Performing Git Commit"
|
||||
if ('${{parameters.DeploymentType}}' -eq 'Beta') {
|
||||
git commit -m "${{parameters.ApplicationName}} Beta $appVersion"
|
||||
}
|
||||
Write-Host "Performing Git Commit"
|
||||
if ('${{parameters.DeploymentType}}' -eq 'Beta') {
|
||||
git commit -m "${{parameters.ApplicationName}} Beta $appVersion"
|
||||
}
|
||||
|
||||
if ('${{parameters.DeploymentType}}' -eq 'Production') {
|
||||
git commit -m "${{parameters.ApplicationName}} $appVersionShort"
|
||||
}
|
||||
if ('${{parameters.DeploymentType}}' -eq 'Production') {
|
||||
git commit -m "${{parameters.ApplicationName}} $appVersionShort"
|
||||
}
|
||||
|
||||
Write-Host "Performing Git Push"
|
||||
git push --set-upstream origin master --porcelain --force
|
||||
pwsh: true
|
||||
workingDirectory: '$(Build.SourcesDirectory)'
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: 'Update VersionBuild Variable'
|
||||
condition: eq('${{parameters.DeploymentType}}', 'Production')
|
||||
enabled: false
|
||||
env:
|
||||
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: './.azure/scripts/UpdateVersionVariable.ps1'
|
||||
arguments: "-variableName 'VersionBuild'"
|
||||
pwsh: true
|
||||
Write-Host "Performing Git Push"
|
||||
git push --set-upstream origin master --porcelain --force
|
||||
pwsh: true
|
||||
workingDirectory: '$(Build.SourcesDirectory)'
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: 'Update VersionRevision Variable'
|
||||
condition: eq('${{parameters.DeploymentType}}', 'Beta')
|
||||
enabled: true
|
||||
env:
|
||||
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: './.azure/scripts/UpdateVersionVariable.ps1'
|
||||
pwsh: true
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: 'Reset VersionRevision Variable'
|
||||
condition: eq('${{parameters.DeploymentType}}', 'Production')
|
||||
enabled: false
|
||||
env:
|
||||
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
||||
VERSIONREVISION: 0
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: './.azure/scripts/UpdateVersionVariable.ps1'
|
||||
arguments: "-variableName 'VersionRevision'"
|
||||
pwsh: true
|
||||
|
||||
- template: azure-pipelines-clean-agent.yml@self
|
||||
- ${{ if eq(parameters.DeploymentType, 'Beta') }}:
|
||||
- template: update-pipeline-variable.yml@self
|
||||
parameters:
|
||||
CleanArtifactsFolder: true
|
||||
CleanBinariesFolder: true
|
||||
CleanSourcesFolder: true
|
||||
CleanPublishFolder: true
|
||||
PublishFolder: $(PublishFolder)
|
||||
VariableName: 'VersionRevision'
|
||||
VariableValue: $(VersionRevision) + 1
|
||||
|
||||
- ${{ if eq(parameters.DeploymentType, 'Production') }}:
|
||||
- template: update-pipeline-variable.yml@self
|
||||
parameters:
|
||||
VariableName: 'VersionBuild'
|
||||
VariableValue: $(VersionBuild) + 1
|
||||
|
||||
- ${{ if eq(parameters.DeploymentType, 'Production') }}:
|
||||
- template: update-pipeline-variable.yml@self
|
||||
parameters:
|
||||
VariableName: 'VersionRevision'
|
||||
VariableValue: 1
|
||||
|
||||
- template: azure-pipelines-clean-agent.yml@self
|
||||
parameters:
|
||||
CleanArtifactsFolder: true
|
||||
CleanBinariesFolder: true
|
||||
CleanSourcesFolder: true
|
||||
CleanPublishFolder: true
|
||||
PublishFolder: $(PublishFolder)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue