我正在使用Azure管道在我的公共GitHub存储库中构建Python轮。我成功地将这些作为构建工件添加到我的.yml中:
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop现在我想用这些轮子生成一个GitHub版本。
尝试#1:创建
我试图通过将GitHub发布任务添加到我的.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我正在做这是一个非大师的分支,但我不认为这是造成上述错误的原因?
尝试2:编辑
由于我并不真的希望在每个提交或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发行版”分支已签出):
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但是现在,当我检查CI时,我在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我做错了什么?
发布于 2019-02-02 00:58:02
文档说,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'我以前也只输入我的回购名称,而不是用户名/回购。
https://stackoverflow.com/questions/54439519
复制相似问题