-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathproject-pipeline-template.yaml
96 lines (92 loc) · 4.31 KB
/
project-pipeline-template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Staged pipeline with an approval process for production releases.
#
# Approvals are not defined here, but rather tied to the environment.
#
# As is, this pipeline template will deploy to the Test environment on commits to any release* branch without approvals,
# and will deploy to the Prod environment on commits to the master branch, after approval.
parameters:
# The full path to the folder containing the project.json file for this pipeline
- name: 'projectPath'
default: '.'
type: string
# The name of the folder to deploy the package to.
- name: 'folderName'
default: 'Default'
type: string
# Either AutoVersion to generate a build number or CurrentVersion to match the project.json version.
- name: 'versioningStrategy'
default: 'CurrentVersion'
type: string
# The environments to update the package version to the deployed version.
# Not required for modern folders or if you do not want to update the package version.
- name: 'environments'
default: ''
type: string
# This pipeline is broken into stages for the approval functionality. Stages are ran independantly, which means the pipeline can pause until the approval is received.
stages:
# Build the nuget package.
- stage: Build
jobs:
- job: BuildJob
pool: # Update this if using dedicated build pool
vmImage: 'windows-latest'
workspace:
clean: all
steps:
- script: 'echo project path: ${{ parameters.projectPath }}, folder name: ${{ parameters.folderName }}, versioning strategy: ${{ parameters.versioningStrategy }}, environments: ${{ parameters.environments }}'
displayName: Log parameters
- task: UiPathInstallPlatform-preview@2 # This installs required exes. Not necessary if using a dedicated build machine.
- task: UiPathPack@2
inputs:
versionType: ${{ parameters.versioningStrategy }}
projectJsonPath: '$(Build.SourcesDirectory)\${{ parameters.projectPath }}'
orchestratorConnection: Orchestrator-Dev-Default # Update this to a service connection for your Orchestrator.
outputPath: '$(Build.ArtifactStagingDirectory)\Output'
# Publish the nuget package for later stages.
- publish: $(Build.ArtifactStagingDirectory)\Output
artifact: drop
# Deploy to the Test environment on commits to any release* branch.
# Note that this stage has no environment defined, and won't have approvals.
# For Test environment approvals, update this to look like the Prod stage, but with using the Test environment.
- stage: DeployToTest
condition: and(succeeded('Build'), startsWith(variables['Build.SourceBranchName'], 'release')) # Only run if the packaging succeeded and we are on a release* branch.
jobs:
- job: DeployToTestJob
pool: # Update this if using dedicated build pool
vmImage: 'windows-latest'
workspace:
clean: all
steps:
- download: current
artifact: drop
- task: UiPathInstallPlatform-preview@2 # This installs required exes. Not necessary if using a dedicated build machine.
- task: UiPathDeploy@2
inputs:
orchestratorConnection: Orchestrator-Test-Default
packagesPath: '$(Pipeline.Workspace)\drop'
folderName: ${{ parameters.folderName }}
environments: ${{ parameters.environments }}
# Deploy to the Prod environment on commits to the master branch.
# Will require approvals as defined by the environment in Azure Devops.
- stage: DeployToProd
condition: and(succeeded('Build'), eq(variables['Build.SourceBranchName'], 'master'))
jobs:
- deployment: DeployToProdJob
pool: # Update this if using dedicated build pool
vmImage: 'windows-latest'
workspace:
clean: all
environment: Production # Update this to your Prod Enviornment in DevOps. This is where you configure the approval process.
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: drop
- task: UiPathInstallPlatform-preview@2 # This installs required exes. Not necessary if using a dedicated build machine.
- task: UiPathDeploy@2
inputs:
orchestratorConnection: Orchestrator-Prod-Default # Update this to a service connection for your Prod Orchestrator.
packagesPath: '$(Pipeline.Workspace)\drop'
folderName: ${{ parameters.folderName }}
environments: ${{ parameters.environments }}