diff --git a/.circleci/config.yml b/.circleci/config.yml index eabe38789..de870b02b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,7 +52,7 @@ jobs: at: ~/ - run: name: Deploy snapshot to Artifactory - command: ./gradlew -PbuildAccess=opensource -PbuildNumber=$CIRCLE_BUILD_NUM -PbuildTag=$CIRCLE_TAG -PartifactoryUrl=$ARTIFACTORY_URL -PartifactoryRepository=$SNAPSHOT_ARTIFACTORY_REPOSITORY -PartifactoryUsername=$ARTIFACTORY_USERNAME -PartifactoryPassword=$ARTIFACTORY_PASSWORD --info --stacktrace artifactoryPublish + command: ./gradlew -PbuildNumber=$CIRCLE_BUILD_NUM -PbuildTag=$CIRCLE_TAG -PartifactoryUrl=$ARTIFACTORY_URL -PartifactoryRepository=$SNAPSHOT_ARTIFACTORY_REPOSITORY -PartifactoryUsername=$ARTIFACTORY_USERNAME -PartifactoryPassword=$ARTIFACTORY_PASSWORD --info --stacktrace artifactoryPublish deploy_release: executor: openjdk_executor working_directory: /home/circleci/mms @@ -61,7 +61,10 @@ jobs: at: ~/ - run: name: Deploy release to Artifactory - command: ./gradlew -PbuildAccess=opensource -PbuildNumber=$CIRCLE_BUILD_NUM -PbuildTag=$CIRCLE_TAG -PartifactoryUrl=$ARTIFACTORY_URL -PartifactoryRepository=$RELEASE_ARTIFACTORY_REPOSITORY -PartifactoryUsername=$ARTIFACTORY_USERNAME -PartifactoryPassword=$ARTIFACTORY_PASSWORD --info --stacktrace artifactoryPublish + command: ./gradlew -PbuildNumber=$CIRCLE_BUILD_NUM -PbuildTag=$CIRCLE_TAG -PartifactoryUrl=$ARTIFACTORY_URL -PartifactoryRepository=$RELEASE_ARTIFACTORY_REPOSITORY -PartifactoryUsername=$ARTIFACTORY_USERNAME -PartifactoryPassword=$ARTIFACTORY_PASSWORD --info --stacktrace artifactoryPublish + - run: + name: Deploy release to Bintray + command: ./gradlew -PbuildNumber=$CIRCLE_BUILD_NUM -PbuildTag=$CIRCLE_TAG -PbintrayUser=$BINTRAY_USER -PbintrayKey=$BINTRAY_KEY --info --stacktrace bintrayUpload workflows: version: 2 diff --git a/build.gradle b/build.gradle index 65a379e73..ba709622a 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ buildscript { dependencies { classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion" classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release" + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' } repositories { maven { url 'https://repo.spring.io/plugins-release' } @@ -12,10 +13,6 @@ buildscript { description = 'Structured Data Version Control' -ext.snapshotBuild = version.contains("SNAPSHOT") -ext.releaseBuild = !version.contains("SNAPSHOT") -ext.milestoneBuild = !(snapshotBuild || releaseBuild) - ext { commonDependencies = [ 'swagger-annotations' : 'io.swagger.core.v3:swagger-annotations:2.1.2', @@ -42,6 +39,17 @@ ext { ] } +String buildTag = project.getProperties().get('buildTag') +if (buildTag != null && !buildTag.isEmpty() && buildTag != version) { + throw new GradleException('Version mismatch: '+buildTag+' vs '+version) +} +if (buildTag == null || buildTag.isEmpty() || project.getProperties().getOrDefault('artifactoryRepository', '').toLowerCase().contains('snapshot')) { + version += '-SNAPSHOT' +} +ext.snapshotBuild = version.contains("SNAPSHOT") +ext.releaseBuild = !version.contains("SNAPSHOT") +ext.milestoneBuild = !(snapshotBuild || releaseBuild) + subprojects { repositories { maven { url 'https://repo.spring.io/plugins-release' } @@ -53,13 +61,13 @@ subprojects { project.sourceCompatibility = '10' project.targetCompatibility = '10' } -} + version = rootProject.version -allprojects { apply plugin: 'java-library' apply plugin: 'maven-publish' apply plugin: 'io.spring.dependency-management' apply plugin: "com.jfrog.artifactory" + apply plugin: 'com.jfrog.bintray' Map commonDependencies = rootProject.ext.commonDependencies @@ -111,4 +119,19 @@ allprojects { } } } + + bintray { + user = project.getProperties().get('bintrayUser') + key = project.getProperties().get('bintrayKey') + publications = ['mavenJava'] + publish = true + dryRun = true + pkg { + repo = 'maven' + name = 'mms-' + project.name + userOrg = 'openmbee' + licenses = ['Apache-2.0'] + vcsUrl = 'https://github.com/Open-MBEE/mms.git' + } + } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 8eb2def0d..1f2de8cf8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=4.0.0-SNAPSHOT +version=4.0.0 group=org.openmbee.mms springBootVersion=2.2.6.RELEASE