-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
azure-pipelines.release-fluentui.yml
194 lines (166 loc) · 7.41 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
pr: none
trigger: none
# Example: fluentui_20190626.1
name: 'fluentui_$(Date:yyyyMMdd)$(Rev:.r)'
resources:
repositories:
- repository: self
type: git
ref: master
- repository: 1esPipelines
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
variables:
# below are variables that cannot be configured at queue time
- group: 'Github and NPM secrets'
- template: .devops/templates/variables.yml@self
parameters:
deployBasePath: 0.0.0-nightly
- name: docsiteVersion # used by docsite
value: 0.0.0-nightly
- name: officialRelease # used by docsite
value: true
- name: tags
value: production,externalfacing
# below are variables configurable at queue time, so they cannot appear in yml file
# - name: dryRun # set it to true in order to execute publishing in dry run mode - nothing will be published
# value: false
# - 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
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
parameters:
pool:
name: Azure-Pipelines-1ESPT-ExDShared
image: windows-latest
os: windows # We need windows because compliance task only run on windows.
stages:
- stage: main
jobs:
- job: Release
pool:
name: '1ES-Host-Ubuntu'
image: '1ES-PT-Ubuntu-20.04'
os: linux
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@self
- script: |
echo "dry run mode enabled!"
displayName: dry run mode notification
condition: eq(variables.dryRun, true)
- 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: build,test,lint northstar packages
inputs:
script: |
yarn nx run-many --targets=build,test,lint,type-check,test-ssr,verify-packaging --projects='packages/fluentui/*' --nxBail
- task: CmdLine@2
displayName: '[NPM] Publish to NPM'
condition: and(succeeded(), eq(variables.publishOfficial, true))
timeoutInMinutes: 2
inputs:
script: |
NPM_TOKEN=$(npmToken)
echo "registry=https://registry.npmjs.org/" > .npmrc
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
npx northstar-release publish --dry-run $(dryRun)
git checkout -- .npmrc
- template: .devops/templates/cleanup.yml@self
- job: Release_docsite
workspace:
clean: all
displayName: Build and Publish Docsite
dependsOn: Release
pool:
name: '1ES-Host-Ubuntu'
image: '1ES-PT-Ubuntu-20.04'
os: linux
# run this job when the previous job is succeeded or when publishDocsiteOnly is true
condition: and(eq(variables.dryRun, false), or(succeeded(), eq(variables.publishDocsiteOnly, true)))
steps:
- template: .devops/templates/tools.yml@self
- script: |
echo "dry run mode enabled!"
displayName: dry run mode notification
condition: eq(variables.dryRun, true)
- 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 base path and version'
condition: and(succeeded(), eq(variables.publishOfficial, true))
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"
- task: CmdLine@2
displayName: Build
inputs:
script: |
echo deployBasePath $(deployBasePath) docsiteVersion $(docsiteVersion)
NODE_ENV=production yarn nx run docs:bundle
- task: AzureCLI@2
displayName: Upload to Azure
inputs:
azureSubscription: 'Azure - fluentsite storage - NEW'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az storage blob upload-batch \
--destination '$web' \
--source packages/fluentui/docs/dist \
--account-name fluentsite \
--destination-path $(deployBasePath) \
--auth-mode login \
--overwrite
- 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: 1ES.PublishPipelineArtifact@1
displayName: 📒 Publish Manifest DocSite
inputs:
artifactName: SBom-DocSite-$(System.JobAttempt)
targetPath: $(System.DefaultWorkingDirectory)/_manifest
- task: 1ES.PublishPipelineArtifact@1
displayName: Publish Docsite as Pipeline Artifact
inputs:
path: packages/fluentui/docs/dist
artifactName: docsite_v$(docsiteVersion)
- template: .devops/templates/cleanup.yml@self