【发布时间】:2021-03-24 00:13:12
【问题描述】:
我有一个用于创建 html 文件的 powershell 脚本,而且我是 Azure DevOps 的新手。该 html 文件必须与构建工件一起编译和生成。我不确定我是怎么做的。有人能指出我在哪里输出发行说明的正确方向吗?是否需要根据stagingdirectory、agent添加文件路径?
- task: PowerShell@2
displayName: "Generate release notes"
inputs:
targetType: 'inline'
script: |
// some stuff that's irrelevant
[string]$fileName = ".\ReleaseNotes.html"
$releaseNotesHtml = "<!DOCTYPE html><html><head><title>Release Notes for" +
$applicationName + "</title></head>" +
"<body>"
foreach($item in $workItemResponse.value)
{
$releaseNotesHtml +=
"<div>" +
"<h4>" + $item.fields.'System.WorkItemType' + " " +
$item.fields.'System.Title' + "</h4>" +
"<b>Description</b><br/>" +
"<p>" + $item.fields.'System.Description' + "</p>" +
"</div>"
}
$releaseNotesHtml += "</body></html>"
#=== Write the release notes to the output file ===
Write-Host "Starting to write release notes to: "$fileName
$releaseNotesHtml | out-file $fileName
Write-Host "Finished writing release notes"
【问题讨论】:
标签: powershell azure-devops powershell-3.0