The GitHub Release plugin provides pipeline steps to create and query GitHub releases.
Step is used to create a new release in a GitHub repository.
writeFile file: 'test.md', text: 'This is a test message.'
createGitHubRelease(
credentialId: 'a1234',
repository: 'jcustenborder/xjc-kafka-connect-plugin',
tag: 'v1.2.9',
commitish: '17b5676aaab28e334c0a9befc86e7615a7539c32',
bodyFile: 'test.md',
draft: true
)
Step is used to list the releases in a GitHub repository.
def releases = listGitHubReleases(
credentialId: 'a1234',
includeDrafts: false,
repository: 'jcustenborder/xjc-kafka-connect-plugin'
)
if (!releases) {
throw new Exception("Releases should not be null.")
}
if(releases.size() != 3) {
throw new Exception("3 Releases should be present.")
}
def releases = listGitHubReleases(
credentialId: 'a1234',
repository: 'jcustenborder/xjc-kafka-connect-plugin',
sortBy: 'SymantecVersion',
sortAscending: false,
tagNamePattern: "^0\\.2\\.\\d+"
)
if (!releases) {
throw new Exception('Releases should not be null.')
}
if(releases.size() != 1) {
throw new Exception('1 Releases should be present.')
}
def release = releases[0]
def tagVersion = release.tagName
def nextVersion = release.nextSymantecRevision()
def expectedVersion = "0.2.14"
if(nextVersion != expectedVersion) {
throw new Exception("Expected version is ${expectedVersion} but ${nextVersion} was returned. Input version ${tagVersion}")
}
Step is used to upload assets to an existing GitHub repository.
uploadGithubReleaseAsset(
credentialId: 'github-token',
repository: 'jcustenborder/xjc-kafka-connect-plugin',
tagName: 'v1.2.9',
uploadAssets: [
[filePath: 'releasenotes.md'],
[filePath: 'release.zip']
]
)