【问题标题】:Formatting Release notes in VSTS Deploy to App Center build task在 VSTS 部署到 App Center 构建任务中格式化发行说明
【发布时间】:2018-05-16 07:44:24
【问题描述】:

我花了大约一个小时来寻找这个问题的答案,但一无所获,所以我希望这里有人可以帮助我。

背景

我们目前正在尝试使用 VSTS 中的 App Center Distribute 构建任务通过 App Center 部署我们的 Xamarin.Forms android 应用。

其中一个设置允许您指向项目中的发行说明文件,然后当您点击进入该文件时,该文件将作为发送的电子邮件和应用中心发行信息的一部分包含在内。此文件必须为 UTF-8 格式。

问题

有没有一种方法可以真正格式化这个文件以便它显示得很好?我尝试使用 HTML,但这不起作用。仅使用纯文本文件时,它会忽略文本文件中的任何换行符,并将所有文本显示为连续字符串。

如果不可能的话,我不会追求任何突破性的格式化,只是想知道是否有一种格式化方式,因此至少不是一个大文本行。

提前致谢

加雷斯

【问题讨论】:

  • 基于源码,读取内容为字符串,恐怕无法格式化,只需要添加简单的release note信息即可。

标签: azure-devops azure-pipelines visual-studio-app-center


【解决方案1】:

您可以在技术上使用 Markdown 进行格式化。不幸的是,微软认为发行说明应该是一个单行字符串,删除显式和隐式换行符,以及转义\n。这是 YAML 任务的简化版本,显示使用 YAML Multiline block scalar 语法添加 releaseNotesInput,该语法在每一行添加一个换行符。

- task: AppCenterDistribute@1
  displayName: AppCenter Distribution iOS Test
  inputs:
    serverEndpoint: AppCenterConnectionName # known as ConnectionName in DevOps
    appSlug: '{name|org}/{app|project}'
    appFile: '$(build.artifactStagingDirectory)/**/*.ipa'
    releaseNotesOption: 'input'
    releaseNotesInput: |+
      #AppCenterDistribute (iOS Test)\n
      \n
      - **Build Number**  : $(build.buildNumber)
      - **Build started** : $(system.pipelineStartTime)
      - **Source Branch** : $(build.sourceBranch)

不幸的是,这会解析为:

#AppCenterDistribute (Android Test)\n\n - Build Number : 20181115.13\n - Build started : 2018-11-15 11:42:44+11:00\n - Source Branch : refs/heads/feature/example\n

只有粗体 ** 包装文本的降价格式实际上可以正确解析。

我会继续尝试……但我不得不说这是我遇到过的最悲伤的降价格式支持。

更新

这行得通:

    releaseNotesInput:  |+

      AppCenterDistribute (iOS UAT)
      ---

      - **Build Number**  : $(build.buildNumber)
      - **Build started** : $(system.pipelineStartTime)
      - **Source Branch** : $(build.sourceBranch)

# 用于标题不起作用,而 --- 可以。 |+ 语法允许必要的空行来触发列表等。

【讨论】:

    【解决方案2】:

    您可以使用Markdown 进行格式化。通过查看格式正确的帖子,您似乎已经知道如何使用它?

    【讨论】:

      【解决方案3】:

      我在尝试添加换行符时遇到了同样的问题。解决方案是在 release_notes 字段中使用双换行符(\n\n 而不是\n)。在我的情况下,我将 release_notes 字段作为 json 发送,因此它变为 \\n\\n

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-03-28
        • 2016-07-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多