GitHub Release task
Create, edit, or discard a GitHub release.
GitHub Release task
Use this task in your pipeline to create, edit, or discard a GitHub release.
GitHub service connection
This task requires a GitHub service connection with Write permission to the GitHub repository. You can create a GitHub service connection in your Azure Pipelines project. Once created, use the name of the service connection in this task's settings.
::: moniker range="> tfs-2018"
|GitHub Connection||(Required) Enter the service connection name for your GitHub connection. Learn more about service connections here.|
|Repository||(Required) Select the name of GitHub repository in which GitHub releases will be created.|
|Action||(Required) Select the type of release operation you want perform. This task can create, edit, or discard a GitHub release.|
|Target||(Required) This is the commit SHA for which the GitHub release will be created. E.g. |
|Tag source||(Required) Configure the tag to be used for release creation. The 'Git tag' option automatically takes the tag which is associated with this commit. Use the 'User specified tag' option in case you want to manually provide a tag.|
|Tag||(Required) Specify the tag for which you want to create, edit, or discard a release. You can also use variables here. E.g. |
|Release title||(Optional) Specify the title of the GitHub release. If left empty, the tag will be used as the release title.|
|Release notes source||(Optional) Specify the description of the GitHub release. Use the 'Release notes file' option to use the contents of a file as release notes. Use the 'Inline release notes' option to manually enter the release notes.|
|Release notes file path||(Optional) Select the file which contains the release notes.|
|Release notes||(Optional) Type your release notes here. Markdown is supported.|
|Assets||(Optional) Specify the files to be uploaded as assets for the release. You can use wildcard characters to specify a set of files. E.g. |
|Asset upload mode||(Optional) Use the 'Delete existing assets' option to first delete any existing assets in the release and then upload all assets. Use the 'Replace existing assets' option to replace any assets that have the same name.|
|Draft release||(Optional) Indicate whether the release should be saved as a draft (unpublished). If |
|Pre-release||(Optional) Indicate whether the release should be marked as a pre-release.|
|Add changelog||(Optional) If set to |
Create a GitHub release
The following YAML creates a GitHub release every time the task runs. The build number is used as the tag version for the release. All .exe files and README.txt files in the $(Build.ArtifactStagingDirectory) folder are uploaded as assets. By default, the task also generates a change log (a list of commits and issues that are part of this release) and publishes it as release notes.
- task: GithubRelease@0 displayName: 'Create GitHub Release' inputs: gitHubConnection: zenithworks repositoryName: zenithworks/javaAppWithMaven tagSource: manual tag: $(Build.BuildNumber) assets: | $(Build.ArtifactStagingDirectory)/*.exe $(Build.ArtifactStagingDirectory)/README.txt
You can also control the creation of the release based on repository tags. The following YAML creates a GitHub release only when the commit that triggers the pipeline has a Git tag associated with it. The GitHub release is created with the same tag version as the associated Git tag.
- task: GithubRelease@0 displayName: 'Create GitHub Release' inputs: gitHubConnection: zenithworks repositoryName: zenithworks/javaAppWithMaven assets: $(Build.ArtifactStagingDirectory)/*.exe
You may also want to use the task in conjunction with task conditions to get even finer control over when the task runs, thereby restricting the creation of releases. For example, in the following YAML the task runs only when the pipeline is triggered by a Git tag matching the pattern 'refs/tags/release-v*'.
- task: GithubRelease@0 displayName: 'Create GitHub Release' condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/release-v') inputs: gitHubConnection: zenithworks repositoryName: zenithworks/javaAppWithMaven assets: $(Build.ArtifactStagingDirectory)/*.exe
Edit a GitHub release
The following YAML updates the status of a GitHub release from 'draft' to 'published'. The release to be edited is determined by the specified tag.
- task: GithubRelease@0 displayName: 'Edit GitHub Release' inputs: gitHubConnection: zenithworks repositoryName: zenithworks/javaAppWithMaven action: edit tag: $(myDraftReleaseVersion) isDraft: false
Delete a GitHub release
The following YAML deletes a GitHub release. The release to be deleted is determined by the specified tag.
- task: GithubRelease@0 displayName: 'Delete GitHub Release' inputs: gitHubConnection: zenithworks repositoryName: zenithworks/javaAppWithMaven action: delete tag: $(myDraftReleaseVersion)
This task is open source on GitHub. Feedback and contributions are welcome.