ajoberstar / reckon

Infer a project's version from your Git repository.
Apache License 2.0
190 stars 28 forks source link

Expose version in build #94

Closed raniejade closed 6 years ago

raniejade commented 6 years ago

I would like to publish to a bintray repo based on the version, something like:

def bintrayRepo = 'spek-dev'
if (rootProject.reckon.getVersion().isFinal()) {
    bintrayRepo = 'spek'
}

bintray {
    user = bintrayUser
    key = bintrayApiKey
    publish = false
    dryRun = true
    pkg {
        repo = bintrayRepo
        desc = "Test framework for Kotlin"
        name = 'spek2'
        userOrg = 'spekframework'
        licenses = ['BSD New']
        labels = ['kotlin', 'testing']
        vcsUrl = 'https://github.com/spekframework/spek.git'

        githubRepo = 'spekframework/spek'

        version {
            name = rootProject.version
        }
    }

    publications = artifacts
}

ReckonExtension already have getVersion but it's package-private.

ajoberstar commented 6 years ago

You should be able to do this with the getVersion method added on the project.version.

project.version.version.isFinal()

Source

ajoberstar commented 6 years ago

Closing under the assumption this is resolved. If that's not true and you want to discuss further, please reopen.

atali commented 5 years ago

Unfortunately it's not working

image