我正在使用Azure Pipelines在公共GitHub存储库中构建Python轮子。我成功地将它们添加为.yml中的构建工件:
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop
我现在想用这些轮子生成一个GitHub版本。
我试图通过将GitHub Release task添加到我的.yml中来创建新版本
- task: GithubRelease@0
inputs:
gitHubConnection: 'my-connection'
repositoryName: 'my-repo'
action: 'create'
target: '$(build.sourceVersion)'
tagSource: 'auto'
assets: '$(Build.ArtifactStagingDirectory)/*'
assetUploadMode: 'replace'
当它在新提交上运行时,这给我一个错误:
2019-01-30T10:54:13.4154988Z ##[section]Starting: GitHubRelease
2019-01-30T10:54:13.4159417Z ==============================================================================
2019-01-30T10:54:13.4159489Z Task : GitHub Release
2019-01-30T10:54:13.4159535Z Description : Create, edit, or delete a GitHub release.
2019-01-30T10:54:13.4159592Z Version : 0.0.2
2019-01-30T10:54:13.4159631Z Author : Microsoft Corporation
2019-01-30T10:54:13.4159688Z Help : [More Information](https://aka.ms/AA3aeiw)
2019-01-30T10:54:13.4159733Z ==============================================================================
2019-01-30T10:54:13.8077592Z 4482b84d-9af2-47ea-ba55-e92f0e856217 exists true
2019-01-30T10:54:13.8078191Z Fetching the tag for target: cd14aa02e85823d52f61d1e5e2fccc307e1504f8
2019-01-30T10:54:14.1969398Z ##[error]An unexpected error occurred while fetching tags.
2019-01-30T10:54:14.1978761Z ##[error]Error: Not Found
2019-01-30T10:54:14.1982593Z ##[section]Finishing: GitHubRelease
我正在做的是一个非主分支,但是我不认为这是上面错误的原因吗?
由于我真的不希望在每次提交或GitHub PR上发布版本,因此我想每次例如触发一次。标签被按下。
所以,我想,好吧,让我们看看将操作更改为“编辑”是否效果更好...所以我将.yml更改为:
- task: GithubRelease@0
inputs:
gitHubConnection: 'my-connection'
repositoryName: 'my-repo'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'auto'
tag: '1.0'
assets: '$(Build.ArtifactStagingDirectory)/*'
assetUploadMode: 'replace'
然后运行以下命令(签出了我的“ github-release”分支):
git commit -am "Try 1.0"
git tag -am "Adding tag 1.0" 1.0
git push origin 1.0 HEAD:refs/heads/github-release
但是现在当我检查配置项时,我在GitHub发布任务上看到了这一点:
2019-01-30T11:28:52.8639389Z ##[section]Starting: GitHubRelease
2019-01-30T11:28:52.8643449Z ==============================================================================
2019-01-30T11:28:52.8643522Z Task : GitHub Release
2019-01-30T11:28:52.8643585Z Description : Create, edit, or delete a GitHub release.
2019-01-30T11:28:52.8643632Z Version : 0.0.2
2019-01-30T11:28:52.8643688Z Author : Microsoft Corporation
2019-01-30T11:28:52.8643752Z Help : [More Information](https://aka.ms/AA3aeiw)
2019-01-30T11:28:52.8643802Z ==============================================================================
2019-01-30T11:28:53.2645821Z 4482b84d-9af2-47ea-ba55-e92f0e856217 exists true
2019-01-30T11:28:53.2646587Z Computing changes made in this release...
2019-01-30T11:28:53.2646657Z Fetching the latest published release...
2019-01-30T11:28:53.7121952Z No releases are published yet in the repository.
2019-01-30T11:28:53.7122209Z Fetching the initial commit...
2019-01-30T11:28:53.8614586Z ##[error]An unexpected error occurred while fetching the initial commit.
2019-01-30T11:28:53.8616507Z ##[error]Error: Not Found
2019-01-30T11:28:53.8654236Z ##[section]Finishing: GitHubRelease
我在做什么错了?
答案 0 :(得分:1)
documentation说tagSource
可以设置为'auto'
或'manual'
,但是我遇到一个网站,说'Git tag'
是一个值,所以我试过了原来效果更好:
- task: GithubRelease@0
inputs:
gitHubConnection: 'my-connection'
repositoryName: 'username/my-repo'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'Git tag'
tag: '1.0'
assetUploadMode: 'replace'
我以前也只输入了我的仓库名称,而不是用户名/仓库。