apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'

group = 'gradle'

// START SNIPPET conditional-signing
version = '1.0-SNAPSHOT'
isReleaseVersion = !version.endsWith("SNAPSHOT")

signing {
    if (isReleaseVersion) {
        sign configurations.archives
    }
}
// END SNIPPET conditional-signing

configurations {
    published.extendsFrom archives, signatures
}

uploadPublished {
    repositories {
        mavenDeployer {
            repository(url: uri("${buildDir}/repo"))
            if (isReleaseVersion) {
                beforeDeployment { MavenDeployment deployment -> signPom(deployment) }
            }
        }
    }
}
