我必须使用Azuredevops通过build.yaml构建javascript应用程序,并且根据Microsoft文档https://docs.microsoft.com/en-us/azure/azure-functions/functions-how-to-azure-devops我无法运行它,因为
“加载YAML构建管道时发生错误。段数错误”异常

pool:
  vmImage: 'ubuntu-latest'

trigger:
  batch: false
  branches:
    include:
    - '*'
  paths:
    exclude:
    - 'Currency/*'
steps:
- bash: |
    if [ -f Convertor.csproj ]
    then
        dotnet build Convertor.csproj --output ./bin
    fi
    npm install
    npm run build --if-present
    npm prune --production
- task: ArchiveFiles@2
  displayName: "Archive files"
  inputs:
    rootFolderOrFile: "$(System.DefaultWorkingDirectory)"
    includeRootFolder: false
    archiveFile: "$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip"
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip'
    artifactName: 'drop'


这是我的build.yaml

最佳答案

您的build.yaml在我的AzureDevops上运行良好。您可以尝试使用azure devops中的向导创建新管道。并将您的build.yaml复制到YAML编辑器,并检查该编辑器是否带有下划线。

您可以找到有关构建/测试/部署Microsoft提供的JavaScript应用程序的示例here

09-04 09:20
查看更多