Skip to content

Commit

Permalink
Correct the github release task to use full version in tag name and r…
Browse files Browse the repository at this point in the history
…elease name
  • Loading branch information
kritika-singh3 committed Jun 12, 2020
1 parent f797b55 commit 957d461
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions plugin-tasks.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ static String gitRevision() {
return process.text.stripIndent().trim()
}

static String distVersion() {
def process = "git rev-list HEAD".execute()
process.waitFor()
return process.text.stripIndent().trim().split("\n").size()
}

static def getLastTag(boolean isExperimental) {
try {
def command = ["git", "describe", "--tags", "--abbrev=0"]
Expand Down Expand Up @@ -72,6 +78,7 @@ static String readableFileSize(long size) {

project.ext.git = {
gitRevision = this.&gitRevision
distVersion = this.&distVersion
getLastTag = this.&getLastTag
getCommitsSinceLastTag = this.&getCommitsSinceLastTag
readableFileSize = this.&readableFileSize
Expand All @@ -83,9 +90,10 @@ task previewGithubRelease() {
def lastTag = project.git.getLastTag(prerelease)
def targetCommitish = project.git.gitRevision()
def assets = distZip.outputs.files.files + distTar.outputs.files.files
def tagName = "${project.version}${prerelease ? '-exp' : ''}"
def fullVersion = project.git.distVersion() ? "${project.version}-${project.git.distVersion()}" : project.version
def tagName = "${fullVersion}${prerelease ? '-exp' : ''}"

def releaseName = "${prerelease ? 'Experimental: ' : ''}${project.version}"
def releaseName = "${prerelease ? 'Experimental: ' : ''}${fullVersion}"
def changelogHeader = lastTag ? "### Changelog ${lastTag}..${targetCommitish.substring(0, 7)}" : "### Changelog"
def changes = project.git.getCommitsSinceLastTag(lastTag).replaceAll("\"", "").stripIndent().trim()

Expand Down Expand Up @@ -137,8 +145,9 @@ github {
assets = distZip.outputs.files.files + distTar.outputs.files.files

prerelease = !"No".equalsIgnoreCase(System.getenv('PRERELEASE'))
tagName = "${project.version}${prerelease ? '-exp' : ''}"
name = "${prerelease ? 'Experimental: ' : ''}${project.version}"
def fullVersion = project.git.distVersion() ? "${project.version}-${project.git.distVersion()}" : project.version
tagName = "${fullVersion}${prerelease ? '-exp' : ''}"
name = "${prerelease ? 'Experimental: ' : ''}${fullVersion}"
def lastTag = project.git.getLastTag(prerelease)
def changelogHeader = lastTag ? "### Changelog ${lastTag}..${lastCommit.substring(0, 7)}" : "### Changelog"
def changeLog = project.git.getCommitsSinceLastTag(lastTag).replaceAll("\"", "")
Expand Down

0 comments on commit 957d461

Please sign in to comment.