-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathfluentui-github-release.yml
More file actions
186 lines (183 loc) · 8.95 KB
/
fluentui-github-release.yml
File metadata and controls
186 lines (183 loc) · 8.95 KB
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
trigger: none
name: $(Date:yyyyMMdd).$(Rev:r)
resources:
pipelines:
- pipeline: "fluentui-android-maven-publish"
project: "ISS"
source: "fluentui-maven-central-publish [1es-pt]"
repositories:
- repository: OfficePipelineTemplates
type: git
name: 1ESPipelineTemplates/OfficePipelineTemplates
ref: refs/tags/release
extends:
template: v1/Office.Official.PipelineTemplate.yml@OfficePipelineTemplates
parameters:
pool:
name: Azure-Pipelines-1ESPT-ExDShared
image: windows-2022
os: windows
customBuildTags:
- ES365AIMigrationTooling-Release
stages:
- stage: Stage_1
displayName: GitHub Release
jobs:
- job: Job_1
displayName: Agent job
condition: succeeded()
timeoutInMinutes: 0
templateContext:
type: releaseJob
isProduction: true
inputs:
- input: pipelineArtifact
buildType: "specific"
project: "$(projectName)"
definition: "$(pipelineDefinition)"
buildVersionToDownload: "specific"
pipelineId: "$(buildId)"
artifactName: "dogfood"
targetPath: "$(Pipeline.Workspace)/fluentui-android-maven-publish/dogfood"
- input: pipelineArtifact
buildType: "specific"
project: "$(projectName)"
definition: "$(pipelineDefinition)"
buildVersionToDownload: "specific"
pipelineId: "$(buildId)"
artifactName: "notes"
targetPath: "$(Pipeline.Workspace)/fluentui-android-maven-publish/notes"
steps:
- task: PowerShell@2
displayName: "Prepare Release Notes"
inputs:
targetType: "inline"
script: |
$sourceNotesPath = "$(Pipeline.Workspace)/fluentui-android-maven-publish/notes/dogfood-release-notes.txt"
$tempNotesPath = "$(Agent.TempDirectory)/github-release-notes.md"
function Format-ReleaseNotesMarkdown {
param([string]$content)
$lines = $content -split "`r?`n"
$formattedLines = @()
$currentSection = ""
$listItemNumber = 1
$inNumberedList = $false
# Helper function to close numbered list code block
function Close-NumberedList {
if ($inNumberedList) {
$formattedLines += "``````"
$formattedLines += ""
$script:inNumberedList = $false
}
}
# Helper function to start numbered list code block
function Start-NumberedList {
if (-not $inNumberedList) {
$formattedLines += ""
$formattedLines += "``````"
$script:inNumberedList = $true
}
}
foreach ($line in $lines) {
$trimmedLine = $line.Trim()
if (-not $trimmedLine -and $formattedLines.Count -eq 0) {
continue
}
switch -Regex ($trimmedLine) {
"^Release version (.+)$" {
$versionNumber = $matches[1]
$formattedLines += "### Release Version ${versionNumber}:"
continue
}
"^(What's new|Fix/enhancement|Note|Notes?)$" {
Close-NumberedList
$formattedLines += "### $trimmedLine"
$currentSection = $trimmedLine
$listItemNumber = 1
continue
}
"^Fluent v[12]:?$" {
Close-NumberedList
$formattedLines += "**$trimmedLine**"
continue
}
"^\s*\d+\.\s*(.+)$" {
$itemText = $matches[1]
Start-NumberedList
$formattedLines += "`t$listItemNumber. $itemText"
$listItemNumber++
continue
}
"^[-•]\s*(.+)$" {
Close-NumberedList
$itemText = $matches[1]
$formattedLines += "- $itemText"
continue
}
"^None$" {
Close-NumberedList
$formattedLines += " None"
continue
}
".+" {
# Check if this should be treated as a numbered list item in Fix/enhancement section
$isStandaloneFixItem = ($currentSection -eq "Fix/enhancement" -and
$trimmedLine -notmatch "^(Fluent|Note|What's)" -and
$trimmedLine -ne "None")
if ($isStandaloneFixItem) {
Start-NumberedList
$formattedLines += "`t$listItemNumber. $trimmedLine"
$listItemNumber++
} else {
Close-NumberedList
$formattedLines += $trimmedLine
}
continue
}
default {
Close-NumberedList
$formattedLines += ""
}
}
}
Close-NumberedList
return $formattedLines -join "`n"
}
if (Test-Path $sourceNotesPath) {
$originalContent = Get-Content -Path $sourceNotesPath -Raw
$formattedContent = Format-ReleaseNotesMarkdown -content $originalContent
$formattedContent | Out-File -FilePath $tempNotesPath -Encoding UTF8 -NoNewline
Write-Host "##vso[task.setvariable variable=ReleaseNotesFilePath]$tempNotesPath"
} else {
Write-Error "Release notes file not found at: $sourceNotesPath"
exit 1
}
- task: PowerShell@2
displayName: "Rename APK Asset"
inputs:
targetType: "inline"
script: |
$sourceApkPath = "$(Pipeline.Workspace)/fluentui-android-maven-publish/dogfood/FluentUI.Demo-dogfood-release.apk"
$targetApkPath = "$(Pipeline.Workspace)/fluentui-android-maven-publish/dogfood/FluentUI_Demo_v$(releaseVersion).apk"
if (Test-Path $sourceApkPath) {
Copy-Item -Path $sourceApkPath -Destination $targetApkPath
Write-Host "##vso[task.setvariable variable=RenamedApkPath]$targetApkPath"
} else {
Write-Error "Source APK file not found at: $sourceApkPath"
exit 1
}
- task: GitHubRelease@1
displayName: "Create GitHub Release"
inputs:
gitHubConnection: "$(githubServiceConnectionName)"
repositoryName: "microsoft/fluentui-android"
action: "create"
target: "$(Build.SourceVersion)"
tagSource: "userSpecifiedTag"
tag: "v$(releaseVersion)"
title: "Release version $(releaseVersion)"
releaseNotesSource: "filePath"
releaseNotesFilePath: "$(ReleaseNotesFilePath)"
assets: "$(RenamedApkPath)"
addChangeLog: false
isPreRelease: false