【问题标题】:Publish build artifact from folder without including root folder从文件夹发布构建工件而不包括根文件夹
【发布时间】:2019-04-22 19:45:53
【问题描述】:

在 Azure DevOps 上,我有一些文件想要发布:

  • $(Build.ArtifactStagingDirectory)/dist/app/index.html
  • $(Build.ArtifactStagingDirectory)/dist/app/bundle.js

我想将它们发布到工件 app.zip 中,其中包含根级别: - index.html - bundle.js

但是,当我使用路径设置为$(Build.ArtifactStagingDirectory)/dist/app 的“发布构建工件”任务时,我在app.zip 中得到以下内容:

  • app/
    • index.html
    • bundle.js

我尝试将发布路径设置为:

  • $(Build.ArtifactStagingDirectory)/dist/app/**
  • $(Build.ArtifactStagingDirectory)/dist/app/*
  • $(Build.ArtifactStagingDirectory)/dist/app/*.*

但所有这些都使构建失败并出现错误Not found PathtoPublish

【问题讨论】:

    标签: continuous-integration azure-devops azure-pipelines artifact


    【解决方案1】:

    如果我理解你的问题,你试图发布 2 个文件作为你的 atficats。 因为您已经准备好使用 app.zip 可能首先重试将其复制到另一个暂存文件夹,然后尝试从那里复制它。或查看以下模式以遍历目录。 那么你需要 - 任务:PublishBuildArtifacts 输入:

     pathtoPublish: $(Build.ArtifactStagingDirectory)/**/*
    artifactName: MyBuildOutputs
    

    干杯。 阿杰

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多