-
Notifications
You must be signed in to change notification settings - Fork 4
/
azure-pipelines.yml
80 lines (66 loc) · 2.91 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
# no PR triggers
pr: none
pool:
vmImage: 'ubuntu-latest'
# Disable next.js telemetry
# Docs: https://nextjs.org/telemetry
variables:
- name: 'NEXT_TELEMETRY_DISABLED'
value: '1'
steps:
# Docs: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/node-js
- task: NodeTool@0
inputs:
versionSpec: '14.x'
checkLatest: true
displayName: 'Install node'
- script: sudo npm install -g yarn
displayName: 'Install yarn'
# Zipping files with symlinks introduces a potential security vulnerability, so we use
# --no-bin-links to prevent symlinks from being created in node_modules.
# Docs: https://classic.yarnpkg.com/en/docs/cli/install/#toc-yarn-install-no-bin-links
- script: yarn install --no-bin-links
displayName: 'Install dependencies'
- script: yarn build
displayName: 'Run yarn build'
# CST needs the default next.js files plus a few additional config/startup files to run
# Docs: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/copy-files
# Default files needed to run yarn start: https://github.com/vercel/next.js/blob/0af3b526408bae26d6b3f8cab75c4229998bf7cb/examples/with-docker/Dockerfile
- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
contents: |
package.json
.next/**
node_modules/**
public/**
next.config.js
next-i18next.config.js
server-preload.js
targetFolder: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId)'
displayName: 'Copy files needed for yarn start'
# Zip up only the necessary files
# Docs: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/archive-files
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId)'
includeRootFolder: false
displayName: 'Zip files needed for yarn start'
# Publish the zip to deploy to App Service using a package, which mounts the zip as a read-only dir
# Docs: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-pipeline-artifact
# Docs: https://docs.microsoft.com/en-us/azure/devops/pipelines/artifacts/pipeline-artifacts
# The release pipeline uses the AzureRmWebAppDeployment Task (not part of this file)
# Docs: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-rm-web-app-deployment
# The App Service deploys the zip package (not part of this file)
# Docs: https://docs.microsoft.com/en-us/azure/app-service/deploy-run-package
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
artifactName: '$(Build.BuildId)'
displayName: 'Publish artifact: $(Build.BuildId)'