Quantcast
Channel: Category Name
Viewing all articles
Browse latest Browse all 5971

Automating Releases in GitHub through Azure Pipelines

$
0
0

Do you own a GitHub repository? Do you create releases on GitHub to distribute software packages? Do you manually compile a list of changes to be included in release notes? If yes, you will be excited to know that you can now automate creation and modification of GitHub Releases directly from Azure Pipelines. This can be done through the GitHub Release task that is now rolled out to all users.

Here is a simple YAML syntax of the task for you to get started:

steps: - task: GithubRelease@0 displayName: 'Create GitHub Release' inputs: githubConnection: zenithworks repositoryName: zenithworks/simplehtml

You can also use the Visual Editor if you prefer.

create github release from azure pipelines

Actions:

There are 3 actions possible using this task:
– Create a GitHub release
– Edit a GitHub release
– Delete a GitHub release

Create a GitHub release: This action is useful when you want to create a new release using the assets generated from successful CI builds. You can do it for all CI runs or only for specific ones. By default, the task will create a release only when a tag is found associated with the commit for which the CI is triggered. A common way to use this task would be to include it as the last step of your CI pipeline. At the end of each pipeline run, this task will check if a tag exists for the triggering commit, if yes then a release will be created in the GitHub repository by uploading the current built binaries as assets and appending changelog to release notes.
You can further restrict the release creation only to certain tag patterns. For this use custom condition in task control options and specify the required tag pattern. This task will then run only when it finds the matching tag.

run the github release task only for specific tag patterns

 

    Edit a GitHub release:  This action is useful especially in cases where you continuously want to update an existing draft release with the latest built assets. With each CI run this task can edit the draft release (identified by tag) and upload latest build assets, release notes etc.

    Here is a sample YAML that edits a release:

    steps: - task: GitHubRelease@0 displayName: 'Edit GitHub Release' inputs: gitHubConnection: zenithworks repositoryName: zenithworks/simplehtml action: edit tag: $(draftReleaseTag) assets: $(Build.ArtifactStagingDirectory)/distributableBinaries/*

    This action can also be used in conjunction with approvals. A draft release can be automatically published publicly once the release notes and assets have been verified manually by 1 or multiple stakeholders and approved.

    Discard a GitHub release: This action can be used to clean up older releases specifically the draft ones. This action deletes all releases matching the specified tag.

    Compiling Release Notes:

    Another exciting feature included in this task is the ability to automatically compile changelog. This task can automatically compute the changes that were done in this release compared to the last published release and append them to the release notes. The list of changes include the commit SHA, message and linked issues.

    Automatically create changelog for GitHub Release using Azure Pipelines

     

    We are excited to have rolled out this feature and want to hear your feedback. Also, all of our built-in tasks, including GitHub release, are open source and available on GitHub for anyone to contribute. If you find any bugs or have any suggestions please feel free to report it there.

    Resources:
    1. Task code in GitHub
    2. YAML syntax and documentation


    Viewing all articles
    Browse latest Browse all 5971

    Trending Articles