forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.release-fluentui.yml
231 lines (195 loc) · 8.29 KB
/
azure-pipelines.release-fluentui.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
pr: none
trigger: none
# Example: fluentui_20190626.1
name: 'fluentui_$(Date:yyyyMMdd)$(Rev:.r)'
schedules:
# minute 0, hour 4 in UTC (5am in UTC+1), any day of month, any month, days 1-5 of week (M-F)
# https://docs.microsoft.com/en-us/azure/devops/pipelines/build/triggers?tabs=yaml&view=azure-devops#supported-cron-syntax
- cron: '0 4 * * 1-5'
displayName: 'Daily release (M-F at 5am UTC+1)'
branches:
include:
- master
resources:
repositories:
- repository: self
type: git
ref: master
variables:
# below are variables that cannot be configured at queue time
- group: 'Github and NPM secrets'
- template: .devops/templates/variables.yml
parameters:
deployBasePath: 0.0.0-nightly
- name: docsiteVersion # used by docsite
value: 0.0.0-nightly
- name: officialRelease # used by docsite
value: true
- name: nightlyReleaseDate # used by nightly built docsite to setup codesandbox correctly
value: empty
- group: InfoSec-SecurityResults
- name: tags
value: production,externalfacing
# below are variables configurable at queue time, so they cannot appear in yml file
# - name: publishDocsiteOnly # set it to true to only run Job_build_publish_doc
# value: false
# - name: publishOfficial # set it to true to publish package to npm, and publish docsite for official releases
# value: false
# - name: releaseVersion # version to publish to npm; only make sense when publishOfficial=true
# value: canary # value can only be canary/patch/minor
jobs:
- template: .devops/templates/compliance-job.yml
- job: Job_build_publish
dependsOn: Compliance
pool: '1ES-Host-Ubuntu'
workspace:
clean: all
displayName: Build and Release Fluent Packages
# skip this job if publishDocsiteOnly is true
condition: and(succeeded(), eq(variables.publishDocsiteOnly, false))
steps:
- template: .devops/templates/tools.yml
- script: |
git config user.name "Fluent UI Build"
git config user.email "fluentui-internal@service.microsoft.com"
git remote set-url origin https://$(githubUser):$(githubPAT)@github.com/microsoft/fluentui.git
displayName: Authenticate git for pushes
- task: CmdLine@2
displayName: Checkout branch for version pushes
condition: and(succeeded(), eq(variables.publishOfficial, true))
inputs:
script: |
BRANCH_NAME=`echo $(Build.SourceBranch) | sed "s/refs\/heads\///"`
git checkout $BRANCH_NAME
git pull
- task: Bash@3
inputs:
filePath: yarn-ci.sh
displayName: yarn
- task: CmdLine@2
displayName: yarn buildci
inputs:
script: yarn buildci
- task: CmdLine@2
displayName: '[Nightly] Pack fluentui packages to ArtifactStagingDirectory'
condition: and(succeeded(), eq(variables.publishOfficial, false))
inputs:
script: |
today=`date +%Y-%m-%d`
echo date today $today
echo "##vso[task.setvariable variable=date]$today"
yarn release:fluentui:pack-nightly
- task: AzureUpload@2
displayName: '[Nightly] Upload tarballs'
condition: and(succeeded(), eq(variables.publishOfficial, false))
inputs:
SourcePath: $(Build.ArtifactStagingDirectory)
azureSubscription: 'UI Fabric (private)'
storage: fluentsite
ContainerName: nightly-builds
BlobPrefix: $(date) # upload tarballs to folder named by today's date
Gzip: true
- task: CmdLine@2
displayName: '[NPM] Publish to NPM'
condition: and(succeeded(), eq(variables.publishOfficial, true))
timeoutInMinutes: 2
inputs:
script: |
yarn logout
NPM_TOKEN=$(npmToken)
touch packages/fluentui/.npmrc
echo "@fluentui:registry=https://registry.npmjs.org/" > packages/fluentui/.npmrc
echo "registry=https://registry.npmjs.org/" >> packages/fluentui/.npmrc
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> packages/fluentui/.npmrc
yarn release:fluentui:$(releaseVersion) --yes
yarn release:fluentui:post-validation
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 📒 Generate Manifest
inputs:
BuildDropPath: $(System.DefaultWorkingDirectory)
- task: PublishPipelineArtifact@1
displayName: 📒 Publish Manifest
inputs:
artifactName: SBom-Build-$(System.JobAttempt)
targetPath: $(System.DefaultWorkingDirectory)/_manifest
- template: .devops/templates/cleanup.yml
- job: Job_build_publish_doc
workspace:
clean: all
displayName: Build and Publish Docsite
dependsOn: Job_build_publish
# run this job when the previous job is succeeded or when publishDocsiteOnly is true
condition: or(succeeded(), eq(variables.publishDocsiteOnly, true))
steps:
- template: .devops/templates/tools.yml
- task: CmdLine@2
displayName: Checkout branch for pull
condition: and(succeeded(), eq(variables.publishOfficial, true))
inputs:
script: |
BRANCH_NAME=`echo $(Build.SourceBranch) | sed "s/refs\/heads\///"`
git checkout $BRANCH_NAME
git pull
- task: Bash@3
displayName: Yarn
inputs:
filePath: yarn-ci.sh
- task: CmdLine@2
displayName: 'Set nightlyReleaseDate'
condition: and(succeeded(), eq(variables.publishOfficial, false))
inputs:
script: |
today=`date +%Y-%m-%d`
echo date today $today
echo "##vso[task.setvariable variable=nightlyReleaseDate]$today"
- task: CmdLine@2
displayName: 'Set base path and version'
condition: and(succeeded(), eq(variables.publishOfficial, true), ne(variables.releaseVersion, 'canary'))
inputs:
script: |
ver=`node -p "require('./packages/fluentui/react-northstar/package.json').version"`
echo "Docsite base path published for version $ver"
echo "##vso[task.setvariable variable=deployBasePath]$ver"
echo "##vso[task.setvariable variable=docsiteVersion]$ver"
echo "##vso[task.setvariable variable=nightlyReleaseDate]"
- task: CmdLine@2
displayName: 'Set base path and version for canary'
condition: and(succeeded(), eq(variables.publishOfficial, true), eq(variables.releaseVersion, 'canary'))
inputs:
script: |
ver=`node -p "require('./packages/fluentui/lerna.json').version"`
echo "Docsite base path published for version $ver"
echo "##vso[task.setvariable variable=deployBasePath]$ver"
echo "##vso[task.setvariable variable=docsiteVersion]$ver"
echo "##vso[task.setvariable variable=nightlyReleaseDate]"
- task: CmdLine@2
displayName: Build
inputs:
script: |
echo deployBasePath $(deployBasePath) docsiteVersion $(docsiteVersion) nightlyReleaseDate $(nightlyReleaseDate)
NODE_ENV=production yarn build:fluentui:docs
- task: AzureUpload@2
displayName: Upload to Azure
inputs:
SourcePath: packages/fluentui/docs/dist
azureSubscription: 'Azure - fluentsite storage'
storage: fluentsite
ContainerName: $web
BlobPrefix: $(deployBasePath)
Gzip: true
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 📒 Generate Manifest Docsite
inputs:
BuildDropPath: $(System.DefaultWorkingDirectory)
# Publish the manifest to a separate artifact to avoid hosting the _manifest files on the website
- task: PublishPipelineArtifact@1
displayName: 📒 Publish Manifest DocSite
inputs:
artifactName: SBom-DocSite-$(System.JobAttempt)
targetPath: $(System.DefaultWorkingDirectory)/_manifest
- task: PublishPipelineArtifact@1
displayName: Publish Docsite as Pipeline Artifact
inputs:
path: packages/fluentui/docs/dist
artifactName: docsite_v$(docsiteVersion)
- template: .devops/templates/cleanup.yml