-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
120 lines (109 loc) · 3.94 KB
/
azure-pipelines.yml
File metadata and controls
120 lines (109 loc) · 3.94 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
trigger:
branches:
include:
- master
- develop
pr: none
variables:
vmImageName: "ubuntu-latest"
branchName: variables["Build.SourceBranchName"]
awsCredentials: "s3-learn.plantanapp.com"
artifactFolderName: "doc"
isDev: $[eq(variables['Build.SourceBranch'], 'refs/heads/develop')]
isProd: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')]
stages:
- stage: Build
displayName: Build
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: NodeTool@0
displayName: Install Node.js
inputs:
versionSpec: "20.x"
- task: Npm@1
displayName: Install packages
inputs:
command: "install"
- task: Npm@1
displayName: Build docusaurus
inputs:
command: "custom"
customCommand: "run build"
- task: CopyFiles@2
displayName: Copy docusaurus files to $(Build.ArtifactStagingDirectory)
inputs:
SourceFolder: "build/"
Contents: "**"
TargetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
displayName: Publish build artifacts to $(artifactFolderName)
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)
ArtifactName: $(artifactFolderName)
publishLocation: "Container"
- stage: DevDeploy
displayName: Deploy to Dev S3
dependsOn: Build
condition: and(succeeded(), eq(variables.isDev, true))
jobs:
- deployment: DeployArtifactsToS3
displayName: Deploy artifacts to S3
pool:
vmImage: $(vmImageName)
environment:
name: 'docs'
strategy:
runOnce:
deploy:
steps:
- task: AmazonWebServices.aws-vsts-tools.S3Upload.S3Upload@1
displayName: Upload artifacts to learn-dev.plantanapp.com S3
inputs:
awsCredentials: $(awsCredentials)
regionName: "us-east-1"
bucketName: "learn-dev.plantanapp.com"
sourceFolder: "$(Pipeline.Workspace)/$(artifactFolderName)/"
globExpressions: "**"
- task: AWSCLI@1
displayName: Invalidate CloudFront Cache
inputs:
awsCredentials: $(awsCredentials)
regionName: "us-east-1"
awsCommand: "cloudfront"
awsSubCommand: "create-invalidation"
awsArguments: '--distribution-id $(DistributionId) --paths "/*"'
- stage: ProdDeploy
displayName: Deploy to Prod S3
dependsOn: Build
condition: and(succeeded(), eq(variables.isProd, true))
jobs:
- deployment: DeployArtifactsToS3
displayName: Deploy artifacts to S3
pool:
vmImage: $(vmImageName)
environment:
name: 'docs'
strategy:
runOnce:
deploy:
steps:
- task: AmazonWebServices.aws-vsts-tools.S3Upload.S3Upload@1
displayName: Upload artifacts to learn.plantanapp.com S3
inputs:
awsCredentials: $(awsCredentials)
regionName: "us-east-1"
bucketName: "learn.plantanapp.com"
sourceFolder: "$(Pipeline.Workspace)/$(artifactFolderName)/"
globExpressions: "**"
- task: AWSCLI@1
displayName: Invalidate CloudFront Cache
inputs:
awsCredentials: $(awsCredentials)
regionName: "us-east-1"
awsCommand: "cloudfront"
awsSubCommand: "create-invalidation"
awsArguments: '--distribution-id $(DistributionId) --paths "/*"'