-
Notifications
You must be signed in to change notification settings - Fork 21
/
azure-pipelines.yml
59 lines (59 loc) · 2.09 KB
/
azure-pipelines.yml
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
# Node.js with React
# Build a Node.js project that uses React..
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- master
stages:
- stage: Build
jobs:
- job: Build
pool:
vmImage: "ubuntu-latest"
steps:
- task: NodeTool@0
inputs:
versionSpec: "20.x"
displayName: "Install Node.js"
- script: |
npm ci
npm run build
displayName: "npm install and build"
- task: CopyFiles@2
inputs:
SourceFolder: "build/"
Contents: "**"
TargetFolder: "$(Build.ArtifactStagingDirectory)"
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: "$(Build.ArtifactStagingDirectory)"
ArtifactName: "drop"
publishLocation: "Container"
- stage: Deployment
displayName: Deploy to S3
dependsOn: Build
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) # do not run the deploy for PR builds
jobs:
- deployment:
pool:
vmImage: "ubuntu-latest"
environment: docs-dev
strategy:
runOnce:
deploy:
steps:
- task: AmazonWebServices.aws-vsts-tools.S3Upload.S3Upload@1
inputs:
awsCredentials: 's3-learn.plantanapp.com'
regionName: "us-east-1"
bucketName: "learn.plantanapp.com"
sourceFolder: "$(Pipeline.Workspace)/drop/"
globExpressions: "**"
- task: AWSCLI@1
inputs:
awsCredentials: 's3-learn.plantanapp.com'
regionName: 'us-east-1'
awsCommand: 'cloudfront'
awsSubCommand: 'create-invalidation'
awsArguments: '--distribution-id $(DistributionId) --paths "/*"'
displayName: "Invalidate CloudFront Cache"