gpt4 book ai didi

azure - 使用 Azure Devops 将文件添加到构建输出的最佳方法是什么

转载 作者:行者123 更新时间:2023-12-03 04:58:13 25 4
gpt4 key购买 nike

假设我有一个 git 存储库。在 Azure DevOps 中,我提取存储库、构建它并部署到我的 Azure Web App 服务。但是,我还想将一个不在 git 存储库中的文件添加到构建输出中。做这个的最好方式是什么?我应该使用特定的任务吗?

最佳答案

您可以使用 powershell 任务来获取(如果可以通过互联网获取)或创建文件

powershell: |
New-Item -Path $(Build.ArtifactStagingDirectory) -Name "testfile1.txt" -ItemType "file" -Value "This is a text string."

此脚本将在 Build.ArtifactStagingDirectory 中创建一个文件,如果您在发布工件之前执行此操作,并且您的工件位于 Build.ArtifactStagingDirectory 中,您应该实现您想要的效果预计。

我假设您使用 YAML 管道,但如果没有,您只需将此脚本复制到此任务的正文中: enter image description here

关于azure - 使用 Azure Devops 将文件添加到构建输出的最佳方法是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63612680/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com