ru-fix / gradle-release-plugin

gradle-release-plugin automates release procedure for gradle based projects. It automatically creates release branches, update project version in gradle.properties file and commit this update in dynamically created tag with auto incremented version.
18 stars 2 forks source link

Apply plugin with groovy DSL #2

Closed hatavan83 closed 4 years ago

hatavan83 commented 5 years ago

I cannot apply this plugin with gradle 5+ and groovy dsl, could you please give me more guideline detail

swarmshine commented 5 years ago

Here is an example of simple java app with groovy dsl

buildscript {
    repositories {
        mavenCentral()
    }
    //Dependency to release plugin for build script
    dependencies {
        classpath "ru.fix:gradle-release-plugin:1.3.6"
    }
}

plugins {
    id "java"
}

//Applying plugin for the project
apply plugin : "ru.fix.gradle.release"

//configure plugin if required
'ru.fix.gradle.release' {
    mainBranch = "master"
    releaseBranchPrefix = "releases/release-"
}

group "gradle-release-usage"
version "1.0-SNAPSHOT"

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

after applying config you can run gradle createBranchRelease

Let us know if there will be any problems with configuration. Also it will be very helpful if you provide gradle error logs

swarmshine commented 5 years ago

Project documentation updated, added groovy dsl example to project readme

hatavan83 commented 5 years ago

@swarmshine Can I customize that repo has only 1 release branch as production without x.y? I think the plugin was tag as release, the hot fix just for lasted release, so that I don't need many branch as production/release-x.y

swarmshine commented 5 years ago

@hatavan83 Could you please clarify the release scheme that you are suggesting: └master └production <-- here we will maintain our release branch and we will tag our releases there, e.g. 1.0, 1.1 etc we expect that gradle createRelease command will

hatavan83 commented 5 years ago

@swarmshine

@hatavan83 Could you please clarify the release scheme that you are suggesting: └master └production <-- here we will maintain our release branch and we will tag our releases there, e.g. 1.0, 1.1 etc we expect that gradle createRelease command will

  • look for existing tags, found that there already exist tags 1.0 and 1.1
  • bases on current production branch plugin will create new tag 1.2 that will contain updated gradle.properties file with updated version=1.2. as a result we will have same branch structure └master └production but now there will be tags 1.0, 1.1 and 1.2 that was made based on production branch. Am I understood you correctly?

Yes, I just need 1 branch as production I want a PR from master to production if PR success, I will release this branch as tag x.x.x

swarmshine commented 4 years ago

Current behavior of createRelease task is following:

In order to implement suggested functionality createRelease can work in a same way, except final step: it could check whether branch has x.y suffix, if branch does not have that, e.g. branch called production, then it can try to scan all possible tags and use major version x.y from that latest tag.

I will create separate issue for this functionality, since it does not have anything to do with groovy DSL. https://github.com/ru-fix/gradle-release-plugin/issues/5

swarmshine commented 4 years ago

@hatavan83 single release branch flow implemented in 1.3.16 release. You can check out documentation and examples.