我在此处定义了一个构建配置:
https://github.com/cpoDesign/APIFramework/blob/master/azure-pipelines.yml
我已经设法使用以下命令生成nuget包
- task: DotNetCoreCLI@2
inputs:
command: pack
projects: '**/*ApiFramework.csproj'
脚本任务输出的一个子集是
Task "PackTask"
2018-11-27T23:02:32.4459067Z Successfully created package '/home/vsts/work/1/a/CPODesign.ApiFramework.1.0.0.nupkg'.
下一步已解决:
我不想创建一个发布到nuget的版本,因为这些步骤必须在逻辑上分开。因此,我创建了一个新步骤,创建一个放置。
配置:
我的放置任务定义:
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop
contents: '**/$(BuildConfiguration)/**/?(*.nupkg)'
构建输出:
2018-11-27T23:04:24.6351310Z ##[section]Starting: PublishBuildArtifacts
2018-11-27T23:04:24.6353582Z ==============================================================================
2018-11-27T23:04:24.6353896Z Task : Publish Build Artifacts
2018-11-27T23:04:24.6353944Z Description : Publish build artifacts to Azure Pipelines/TFS or a file share
2018-11-27T23:04:24.6354007Z Version : 1.142.2
2018-11-27T23:04:24.6354046Z Author : Microsoft Corporation
2018-11-27T23:04:24.6354091Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=708390)
2018-11-27T23:04:24.6354156Z ==============================================================================
2018-11-27T23:04:26.1357631Z ##[section]Async Command Start: Upload Artifact
2018-11-27T23:04:26.1357755Z Uploading 1 files
2018-11-27T23:04:26.6373194Z File upload succeed.
2018-11-27T23:04:26.6373313Z Upload '/home/vsts/work/1/a' to file container: '#/1558454/drop'
2018-11-27T23:04:27.9231805Z Associated artifact 91 with build 806
2018-11-27T23:04:27.9231947Z ##[section]Async Command End: Upload Artifact
2018-11-27T23:04:27.9232436Z ##[section]Finishing: PublishBuildArtifacts
注意:用于azure-devops的用户界面已更改,伪像(伪像)不再创建为新标签,而是被错误地添加到报告摘要中
问题:
如何生成特定版本的nuget包IE:1.0。%(Build.BuildId)?
我最后一次尝试是
- task: DotNetCoreCLI@2
inputs:
command: pack
projects: '**/*ApiFramework.csproj'
# packageVersion:'1.0.$(Build.BuildId)'
其中
packageVersion:'1.0.$(Build.BuildId)'
将导致构建失败 (当前分支发布在这里:https://github.com/cpoDesign/APIFramework/blob/cpoDesign-build-mods-1/azure-pipelines.yml)
答案 0 :(得分:0)
我无法将内容视为PublishBuildArtifacts @ 1的YAML中的有效输入
您是要先执行复制任务,然后再执行发布任务。如发布文档中所示? https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-build-artifacts?view=vsts
答案 1 :(得分:0)
令人沮丧的几个小时后,我找到了答案
d <- 1000 #original dimension
k <- 500 #reduced dimension
n <- 10 #number of points
mu <- rep(0,d)
sigma <- diag(x=rep(1,d))
u <- sapply(1:k, function(x){
mvrnorm(d, mu, sigma)
})
v <- sapply(1:n, function(x){
mvrnorm(d, mu, sigma)
})
projection <- sapply(1:k, function(j) {sapply(1:d, function(i) u[i,j] * v[i])})
我已更新发行版,以在每次成功构建后触发
pool:
vmImage: 'Ubuntu 16.04'
variables:
buildConfiguration: 'Release'
steps:
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
- task: DotNetCoreCLI@2
inputs:
command: restore
projects: '**/*.csproj'
- script: dotnet test **/*.Tests.Unit.csproj --logger trx
- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
- script: dotnet pack /p:PackageVersion='1.0.$(Build.BuildId)' --configuration $(buildConfiguration) -o $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop
contents: '**/$(BuildConfiguration)/**/?(*.nupkg)'