1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/documentation/docs/steps/githubPublishRelease.md
Oliver Nocon a8a29b753a
add step githubPublishRelease (#345)
This step allows to easily create a new release for your GitHub repository

* include PR review feedback - add additional labels
* consider return status of api call
2018-10-25 16:56:09 +02:00

3.3 KiB

githubPublishRelease

Description

This step creates a tag in your GitHub repository together with a release.

The release can be filled with text plus additional information like:

  • Closed pull request since last release
  • Closed issues since last release
  • link to delta information showing all commits since last release

The result looks like

Example release

Prerequisites

You need to create a personal access token within GitHub and add this to the Jenkins credentials store.

Please see GitHub documentation for details about creating the personal access token.

Example

Usage of pipeline step:

githubPublishRelease script: this, releaseBodyHeader: "**This is the latest success!**<br />"

Parameters

parameter mandatory default possible values
script yes
addClosedIssues no false
addDeltaToLastRelease no false
customFilterExtension no ``
excludeLabels no
  • duplicate
  • invalid
  • question
  • wontfix
githubApiUrl no //https://api.github.com
githubOrg yes script.commonPipelineEnvironment.getGitFolder()
githubRepo yes script.commonPipelineEnvironment.getGitRepo()
githubServerUrl no https://github.com
githubTokenCredentialsId yes
releaseBodyHeader no
version yes script.commonPipelineEnvironment.getArtifactVersion()

Details:

  • script defines the global script environment of the Jenkinsfile run. Typically this is passed to this parameter. This allows the function to access the commonPipelineEnvironment for storing the measured duration.
  • All GitHub related properties allow you to overwrite the default behavior of identifying e.g. GitHub organization, GitHub repository.
  • version defines the version number which will be written as tag as well as release name
  • By defining the releaseBodyHeader you can specify the content which will appear for the release
  • If you set addClosedIssues to true, a list of all closed issues and merged pull-requests since the last release will added below the releaseBodyHeader
  • If you set addDeltaToLastRelease to true, a link will be added to the relese information that brings up all commits since the last release.
  • By passing the parameter customFilterExtension it is possible to pass additional filter criteria for retrieving closed issues since the last release. Additional criteria could be for example specific label, or filter according to GitHub API documentation.
  • It is possible to exclude issues with dedicated labels using parameter excludeLabels. Usage is like excludeLabels: ['label1', 'label2']

Step configuration

We recommend to define values of step parameters via config.yml file.

In following sections the configuration is possible:

parameter general step stage
script
addClosedIssues X X
addDeltaToLastRelease X X
customFilterExtension X X
excludeLabels X X
githubApiUrl X X X
githubOrg X X
githubRepo X X
githubServerUrl X X X
githubTokenCredentialsId X X X
releaseBodyHeader X X
version X X