-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
150 lines (126 loc) · 4.17 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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Global variables
variables:
project_name: "Documentation - Isogeo Scan"
project_name_clean: "scan"
yarn_cache_folder: $(Pipeline.Workspace)/.yarn/cache
trigger:
batch: true
branches:
include:
- master
tags:
include:
- "*"
pr:
- master
jobs:
- job: 'Build'
displayName: "Build the documentation website"
pool:
vmImage: "ubuntu-latest"
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.18.2'
displayName: 'Install Node.js 12.18.2'
# - task: CacheBeta@0
# continueOnError: true
# inputs:
# key: "isogeo-help-yarn-$(Agent.OS)"
# path: $(yarn_cache_folder)
# displayName: 'Cache Yarn packages'
- script: yarn global add gitbook
displayName: 'Install Gitbook'
- script: yarn install --frozen-lockfile --ignore-engines
displayName: 'Install dependencies'
- script: yarn gitbook install
displayName: 'Install Gitbook dependencies'
- script: yarn gitbook build ./ dist/
displayName: 'Build Gitbook HTML output'
- task: DeleteFiles@1
displayName: 'Remove files to be ignored in publication'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/dist'
Contents: |
.dockerignore
.gitignore
.vscode/*
azure-pipelines.yml
Dockerfile
package.json
yarn.lock
- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: $(project_name)'
inputs:
path: $(System.DefaultWorkingDirectory)/dist
artifact: '$(project_name)_$(Build.SourceBranchName)_$(Build.BuildId)'
# PUBLISH TO QA
- job: 'PublishQA'
displayName: "Publish to QA"
dependsOn: 'Build'
pool:
vmImage: "windows-2019"
steps:
# no need for source code
- checkout: none
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: '$(project_name)_$(Build.SourceBranchName)_$(Build.BuildId)'
targetPath: '$(System.DefaultWorkingDirectory)/book_to_upload'
- powershell: |
Rename-Item -Path "robots_qa.txt" -NewName "robots.txt"
Remove-Item -Path "robots_prod.txt"
workingDirectory: '$(System.DefaultWorkingDirectory)/book_to_upload'
displayName: 'Rename robots.txt file for QA'
- task: AzureFileCopy@3
displayName: 'Copy files to Azure Storage Blob: qaisogeohelp/$web/$(project_name_clean)'
inputs:
SourcePath: '$(System.DefaultWorkingDirectory)/book_to_upload'
azureSubscription: 'Isogeo - MPN(82885610-5841-4749-8d71-46f56b643ad2)'
Destination: 'AzureBlob'
storage: 'qaisogeohelp'
ContainerName: '$web'
BlobPrefix: '$(project_name_clean)'
# PUBLISH
# only with a tagged commit (see: https://github.com/MicrosoftDocs/vsts-docs/issues/3281)
- job: 'PublishPROD'
displayName: "Publish to PROD"
dependsOn: 'Build'
pool:
vmImage: "windows-2019"
condition:
contains(variables['Build.SourceBranch'], 'tags')
steps:
# no need for source code
- checkout: none
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: '$(project_name)_$(Build.SourceBranchName)_$(Build.BuildId)'
targetPath: '$(System.DefaultWorkingDirectory)/book_to_upload'
- powershell: |
Rename-Item -Path "robots_prod.txt" -NewName "robots.txt"
Remove-Item -Path "robots_qa.txt"
workingDirectory: '$(System.DefaultWorkingDirectory)/book_to_upload'
displayName: 'Rename robots.txt file for PROD'
- task: GitHubRelease@1
displayName: 'Publish release on Github'
inputs:
gitHubConnection: 'github_isogeo'
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'gitTag'
assets: '$(Build.ArtifactStagingDirectory)/book_to_upload/*'
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'issueBased'
- task: AzureFileCopy@3
displayName: 'Copy files to Azure Storage Blob: prodisogeohelp/$web/$(project_name_clean)'
inputs:
SourcePath: '$(System.DefaultWorkingDirectory)/book_to_upload'
azureSubscription: 'Isogeo - MPN(82885610-5841-4749-8d71-46f56b643ad2)'
Destination: 'AzureBlob'
storage: 'prodisogeohelp'
ContainerName: '$web'
BlobPrefix: '$(project_name_clean)'