forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.release-fluentui.yml
190 lines (162 loc) · 7.23 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
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
- 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: 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
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: Job_build_publish
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: |
git config user.name "Fluent UI Build"
git config user.email "[email protected]"
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: '[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 northstar:release bump $(releaseVersion) --yes
- template: .devops/templates/cleanup.yml@self
- job: Job_build_publish_doc
workspace:
clean: all
displayName: Build and Publish Docsite
dependsOn: Job_build_publish
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: or(succeeded(), eq(variables.publishDocsiteOnly, true))
steps:
- template: .devops/templates/tools.yml@self
- 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), 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"
- task: CmdLine@2
displayName: Build
inputs:
script: |
echo deployBasePath $(deployBasePath) docsiteVersion $(docsiteVersion)
NODE_ENV=production yarn northstar:build: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@self