diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ae5efd8..69377178 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,11 +99,11 @@ jobs: key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }} restore-keys: ${{ runner.os }}-gradle - - name: Publish snapshot to oss.jfrog.org - run: ./gradlew artifactoryPublish + - name: Publish snapshot to oss.sonatype.org + run: ./gradlew publish -Dorg.gradle.internal.publish.checksums.insecure=true env: - BINTRAY_USER: ${{ secrets.BINTRAY_USER }} - BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }} + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} release: @@ -135,8 +135,10 @@ jobs: key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }} restore-keys: ${{ runner.os }}-gradle - - name: Release a new stable version to bintray - run: ./gradlew bintrayUpload -Drelease=true + - name: Release a new stable version to Maven Central + run: ./gradlew publish -Drelease=true env: - BINTRAY_USER: ${{ secrets.BINTRAY_USER }} - BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }} + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} diff --git a/README.md b/README.md index c156c581..f70f8a00 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,11 @@ Otherwise download `flatlaf-.jar` here: ### Snapshots -FlatLaf snapshot binaries are available in -[JFrog Artifactory](https://oss.jfrog.org/artifactory/oss-snapshot-local/com/formdev/). -To access the latest snapshot, change the FlatLaf version(s) in the dependencies +FlatLaf snapshot binaries are available on +[Sonatype OSSRH](https://oss.sonatype.org/content/repositories/snapshots/com/formdev/flatlaf/). +To access the latest snapshot, change the FlatLaf version in your dependencies to `-SNAPSHOT` (e.g. `0.27-SNAPSHOT`) and add the repository -`https://oss.jfrog.org/artifactory/oss-snapshot-local` to your build (see +`https://oss.sonatype.org/content/repositories/snapshots/` to your build (see [Maven](https://maven.apache.org/guides/mini/guide-multiple-repositories.html) and [Gradle](https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:declaring_custom_repository) diff --git a/build.gradle.kts b/build.gradle.kts index 23873cbf..1766ba31 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,7 +23,7 @@ allprojects { version = rootProject.version repositories { - jcenter() + mavenCentral() } } @@ -40,17 +40,6 @@ println( "Java ${System.getProperty( "java.version" )}" ) println() -extra["bintray.user"] = System.getenv( "BINTRAY_USER" ) ?: System.getProperty( "bintray.user" ) -extra["bintray.key"] = System.getenv( "BINTRAY_KEY" ) ?: System.getProperty( "bintray.key" ) - -// if true, do not upload to bintray -extra["bintray.dryRun"] = false - -// if true, uploaded artifacts are visible to all -// if false, only visible to owner when logged into bintray -extra["bintray.publish"] = false - - allprojects { tasks { withType().configureEach { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index cd322038..b6444127 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -20,15 +20,5 @@ plugins { // required for kotlin-dsl or embedded-kotlin plugins repositories { - jcenter() -} - -dependencies { - // NOTE: keep plugin versions in sync with settings.gradle.kts - - // "com.jfrog.bintray" plugin - implementation( "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4" ) - - // "com.jfrog.artifactory" plugin - implementation( "org.jfrog.buildinfo:build-info-extractor-gradle:4.13.0" ) + mavenCentral() } diff --git a/buildSrc/src/main/kotlin/flatlaf-publish.gradle.kts b/buildSrc/src/main/kotlin/flatlaf-publish.gradle.kts index 59d69d73..d9005d39 100644 --- a/buildSrc/src/main/kotlin/flatlaf-publish.gradle.kts +++ b/buildSrc/src/main/kotlin/flatlaf-publish.gradle.kts @@ -26,8 +26,7 @@ val extension = project.extensions.create( "flatlafPublish" ) plugins { `maven-publish` - id( "com.jfrog.bintray" ) - id( "com.jfrog.artifactory" ) + signing } publishing { @@ -74,49 +73,40 @@ publishing { } } } -} -bintray { - user = rootProject.extra["bintray.user"] as String? - key = rootProject.extra["bintray.key"] as String? + repositories { + maven { + name = "OSSRH" - setPublications( "maven" ) + val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" + val snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/" + url = uri( if( java.lang.Boolean.getBoolean( "release" ) ) releasesRepoUrl else snapshotsRepoUrl ) - with( pkg ) { - repo = "flatlaf" - afterEvaluate { - this@with.name = extension.artifactId + credentials { + // get from gradle.properties + val ossrhUsername: String? by project + val ossrhPassword: String? by project + + username = System.getenv( "OSSRH_USERNAME" ) ?: ossrhUsername + password = System.getenv( "OSSRH_PASSWORD" ) ?: ossrhPassword + } } - setLicenses( "Apache-2.0" ) - vcsUrl = "https://github.com/JFormDesigner/FlatLaf" - - with( version ) { - name = project.version.toString() - } - - publish = rootProject.extra["bintray.publish"] as Boolean - dryRun = rootProject.extra["bintray.dryRun"] as Boolean } } -artifactory { - setContextUrl( "https://oss.jfrog.org" ) +signing { + // get from gradle.properties + val signingKey: String? by project + val signingPassword: String? by project - publish( closureOf { - repository( delegateClosureOf { - setProperty( "repoKey", "oss-snapshot-local" ) - setProperty( "username", rootProject.extra["bintray.user"] as String? ) - setProperty( "password", rootProject.extra["bintray.key"] as String? ) - } ) + val key = System.getenv( "SIGNING_KEY" ) ?: signingKey + val password = System.getenv( "SIGNING_PASSWORD" ) ?: signingPassword - defaults( delegateClosureOf { - invokeMethod( "publications", "maven" ) - setProperty( "publishArtifacts", true ) - setProperty( "publishPom", true ) - } ) - } ) - - resolve( delegateClosureOf { - setProperty( "repoKey", "jcenter" ) - } ) + useInMemoryPgpKeys( key, password ) + sign( publishing.publications["maven"] ) +} + +// disable signing of snapshots +tasks.withType().configureEach { + onlyIf { java.lang.Boolean.getBoolean( "release" ) } } diff --git a/flatlaf-demo/build.gradle.kts b/flatlaf-demo/build.gradle.kts index 589ef5dc..7e5110da 100644 --- a/flatlaf-demo/build.gradle.kts +++ b/flatlaf-demo/build.gradle.kts @@ -16,15 +16,6 @@ plugins { `java-library` - id( "com.jfrog.bintray" ) - - // Although artifactory plugin is not used in this subproject, the plugin is required - // because otherwise gradle fails with following error: - // Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: - // Cannot cast object 'task ':bintrayUpload'' - // with class 'com.jfrog.bintray.gradle.tasks.BintrayUploadTask_Decorated' - // to class 'com.jfrog.bintray.gradle.tasks.BintrayUploadTask' - id( "com.jfrog.artifactory" ) } repositories { @@ -68,24 +59,3 @@ tasks { } ) } } - -bintray { - user = rootProject.extra["bintray.user"] as String? - key = rootProject.extra["bintray.key"] as String? - - setConfigurations( "archives" ) - - with( pkg ) { - repo = "flatlaf" - name = "flatlaf-demo" - setLicenses( "Apache-2.0" ) - vcsUrl = "https://github.com/JFormDesigner/FlatLaf" - - with( version ) { - name = project.version.toString() - } - - publish = rootProject.extra["bintray.publish"] as Boolean - dryRun = rootProject.extra["bintray.dryRun"] as Boolean - } -} diff --git a/settings.gradle.kts b/settings.gradle.kts index dc56e133..20e32de3 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -24,11 +24,3 @@ include( "flatlaf-intellij-themes" ) include( "flatlaf-demo" ) include( "flatlaf-testing" ) include( "flatlaf-theme-editor" ) - -pluginManagement { - plugins { - // NOTE: keep plugin versions in sync with buildSrc/build.gradle.kts - id( "com.jfrog.bintray" ) version "1.8.4" - id( "com.jfrog.artifactory" ) version "4.13.0" - } -}