Use org.ajoberstar.release-opinion plugin for versioning
gradle-git was upgraded to 1.7.1.
Publising to GhPages was refactored to use separate plugin.
MODIFY
build.gradle
build.gradle
+buildscript {
+ repositories {
+ jcenter()
+ }
+
+ dependencies {
+ classpath "org.ajoberstar:gradle-git:1.7.1"
+ }
+}
+
group = 'com.bmuschko'
-version = '3.0.8'
apply plugin: 'groovy'
apply plugin: 'idea'
-apply from: "$rootDir/gradle/dependencies.gradle"
+apply plugin: 'org.ajoberstar.release-opinion'
apply from: "$rootDir/gradle/test-setup.gradle"
apply from: "$rootDir/gradle/integration-test.gradle"
apply from: "$rootDir/gradle/functional-test.gradle"
apply from: "$rootDir/gradle/additional-artifacts.gradle"
+apply from: "$rootDir/gradle/release.gradle"
apply from: "$rootDir/gradle/publishing.gradle"
apply from: "$rootDir/gradle/documentation.gradle"
-apply from: "$rootDir/gradle/release.gradle"
repositories {
mavenCentral()

DELETE
gradle/dependencies.gradle
-ext.depVersions = ['gradleGit': '1.4.2']
\ No newline at end of file

MODIFY
gradle/documentation.gradle
gradle/documentation.gradle
@@ -4,29 +4,16 @@ buildscript {
}
dependencies {
- classpath "org.ajoberstar:gradle-git:$depVersions.gradleGit"
+ classpath "org.ajoberstar:gradle-git-publish:0.2.1"
}
}
-apply plugin: org.ajoberstar.gradle.git.ghpages.GithubPagesPlugin
+apply plugin: org.ajoberstar.gradle.git.publish.GitPublishPlugin
-ext {
- repoPath = 'bmuschko/gradle-docker-plugin'
- ghToken = System.getenv('GH_TOKEN')
-}
-
-githubPages {
- if (ghToken) {
- repoUri = "https://github.com/${repoPath}.git"
- credentials {
- username = ghToken
- password = ''
- }
- } else {
- repoUri = "git@github.com:${repoPath}.git"
- }
+gitPublish {
+ repoUri = 'git@github.com:bmuschko/gradle-docker-plugin.git'
- pages {
+ contents {
from(javadoc.outputs.files) {
into 'docs/javadoc'
}
@@ -36,4 +23,4 @@ githubPages {
}
}
-publishGhPages.dependsOn javadoc, groovydoc
+gitPublishPush.dependsOn javadoc, groovydoc

MODIFY
gradle/release.gradle
gradle/release.gradle
+import org.ajoberstar.grgit.Grgit
+import org.ajoberstar.gradle.git.release.opinion.Strategies
+
buildscript {
repositories {
jcenter()
}
dependencies {
- classpath "org.ajoberstar:gradle-git:$depVersions.gradleGit"
+ classpath "org.ajoberstar:gradle-git:1.7.1"
}
}
-import org.ajoberstar.grgit.Grgit
-
ext.repo = Grgit.open(rootDir)
-task createTag {
- description = 'Creates repository tag with current project version.'
- ext.tagName = "v${project.version}"
-
- doLast {
- logger.quiet "Creating tag '$tagName'."
-
- // Remove potentially existing tag
- repo.tag.remove(names: [tagName])
-
- // Create tag
- repo.tag.add {
- name = tagName
- message = "Version ${project.version}"
- }
- }
-}
-
-task pushTag {
- description = 'Pushes tag to remote repository.'
- dependsOn createTag
-
- doLast {
- logger.quiet "Pushing tag '$createTag.tagName' to remote."
+release {
+ grgit = Grgit.open(rootDir)
+ versionStrategy Strategies.FINAL
+ defaultVersionStrategy = Strategies.SNAPSHOT
- repo.push {
- refsOrSpecs = [createTag.tagName]
+ tagStrategy {
+ generateMessage = { version -> "Version ${project.version.version}" }
}
}
-}
-
-task tag {
- dependsOn pushTag
- mustRunAfter bintrayUpload
-}
-task release {
- description = 'Publishes artifacts to Bintray and tags repository with current project version.'
- dependsOn assemble, bintrayUpload, tag
-}
\ No newline at end of file
+tasks.release.dependsOn 'assemble', 'bintrayUpload'

Use org.ajoberstar.release-opinion plugin for versioning

gradle-git was upgraded to 1.7.1.
Publising to GhPages was refactored to use separate plugin.