From abac03dd661c38aba971c4dc20984f0da17531b6 Mon Sep 17 00:00:00 2001 From: Edwin Jakobs Date: Sun, 28 Nov 2021 13:57:50 +0100 Subject: [PATCH] Attempt to publish ORX on Maven Central --- .github/workflows/generate-screenshots.yml | 2 +- .../release-candidate-to-maven-central.yml | 29 ++++ .../workflows/release-to-maven-central.yml | 12 +- build.gradle | 138 ++++++++++++++++-- openrndr-demos/build.gradle | 2 + 5 files changed, 167 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/release-candidate-to-maven-central.yml diff --git a/.github/workflows/generate-screenshots.yml b/.github/workflows/generate-screenshots.yml index 0a904fc8f..aba43ea20 100644 --- a/.github/workflows/generate-screenshots.yml +++ b/.github/workflows/generate-screenshots.yml @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-java@v1 with: - java-version: 16 + java-version: 17 - uses: openrndr/setup-opengl@v1.1 - name: Test glxinfo run: | diff --git a/.github/workflows/release-candidate-to-maven-central.yml b/.github/workflows/release-candidate-to-maven-central.yml new file mode 100644 index 000000000..f2237eca2 --- /dev/null +++ b/.github/workflows/release-candidate-to-maven-central.yml @@ -0,0 +1,29 @@ +name: Release candidate to Maven Central +on: + push: + tags: + - v[0-9].[0-9]+.[0-9]+-rc.[0-9]+ +jobs: + build: + runs-on: ubuntu-18.04 + steps: + - name: Get OPENRNDR release tag + run: echo "OPENRNDR_VERSION=$(git ls-remote --refs --tags https://github.com/openrndr/openrndr | cut --delimiter='/' --fields=3 | sort --version-sort | tail --lines=1)" >> $GITHUB_ENV + - uses: actions/checkout@v2 + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/} + - uses: actions/setup-java@v1 + with: + java-version: 17 + - name: Build ORX + run: ./gradlew -Prelease.useLastTag=true build + - name: Decode + run: | + echo "${{secrets.SIGNING_SECRET_KEY_RING_FILE}}" > ~/.gradle/secring.gpg.b64 + base64 -d ~/.gradle/secring.gpg.b64 > ~/.gradle/secring.gpg + - name: Publish + run: ./gradlew publish -Popenrndr.version=${{env.OPENRNDR_VERSION}} -Prelease.useLastTag=true -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password=${{secrets.SIGNING_KEY_PASSWORD}} -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg) + env: + OSSRH_USERNAME: ${{secrets.OSSRH_USERNAME}} + OSSRH_PASSWORD: ${{secrets.OSSRH_PASSWORD}} \ No newline at end of file diff --git a/.github/workflows/release-to-maven-central.yml b/.github/workflows/release-to-maven-central.yml index f1941b90a..1ed8d87b4 100644 --- a/.github/workflows/release-to-maven-central.yml +++ b/.github/workflows/release-to-maven-central.yml @@ -1,4 +1,4 @@ -name: Release to Bintray +name: Release to Maven Central on: push: tags: @@ -7,21 +7,23 @@ jobs: build: runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v2 + - name: Get OPENRNDR release tag + run: echo "OPENRNDR_VERSION=$(git ls-remote --refs --tags https://github.com/openrndr/openrndr | cut --delimiter='/' --fields=3 | sort --version-sort | tail --lines=1)" >> $GITHUB_ENV + - uses: actions/checkout@v2 - name: Get the version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/} - uses: actions/setup-java@v1 with: - java-version: 8 - - name: Build and publish to local maven + java-version: 17 + - name: Build ORX run: ./gradlew -Prelease.useLastTag=true build - name: Decode run: | echo "${{secrets.SIGNING_SECRET_KEY_RING_FILE}}" > ~/.gradle/secring.gpg.b64 base64 -d ~/.gradle/secring.gpg.b64 > ~/.gradle/secring.gpg - name: Publish - run: ./gradlew publish -Prelease.useLastTag=true -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password=${{secrets.SIGNING_KEY_PASSWORD}} -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg) + run: ./gradlew publish -Popenrndr.version=${{env.OPENRNDR_VERSION}} -Prelease.useLastTag=true -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password=${{secrets.SIGNING_KEY_PASSWORD}} -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg) env: OSSRH_USERNAME: ${{secrets.OSSRH_USERNAME}} OSSRH_PASSWORD: ${{secrets.OSSRH_PASSWORD}} \ No newline at end of file diff --git a/build.gradle b/build.gradle index a2406aabf..bcfa6e685 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,3 @@ -import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform - buildscript { repositories { mavenCentral() @@ -34,6 +32,8 @@ def multiplatformModules = [ "orx-quadtree", ] +def doNotPublish = ["openrndr-demos"] + project.ext { kotlinApiVersion = '1.6' kotlinLanguageVersion = '1.6' @@ -47,14 +47,17 @@ project.ext { junitJupiterVersion = '5.7.1' } -def openrndrUseSnapshot = true + + apply plugin: 'org.jetbrains.dokka' ext.isReleaseVersion = !version.endsWith("SNAPSHOT") +def openrndrUseSnapshot = isReleaseVersion + project.ext { - openrndrVersion = openrndrUseSnapshot? "0.5.1-SNAPSHOT" : "0.4.0" + openrndrVersion = findProperty("openrndr.version")?.replace("v","") ?: "0.5.1-SNAPSHOT" jvmTarget = "1.8" kotlinVersion = "1.6.0" kotlinApiVersion = "1.4" @@ -181,20 +184,134 @@ task buildMainReadme { } } +configure(allprojects.findAll { !doNotPublish.contains(it.name) && (multiplatformModules.contains(it.name)) }) { + apply plugin: 'maven-publish' + apply plugin: 'signing' -configure(allprojects.findAll { !multiplatformModules.contains(it.name) }) { + def fjdj = tasks.create("fakeJavaDocJar", Jar) { + archiveClassifier = "javadoc" + } + + + publishing { + publications { + all { + pom { + name = "$project.name" + description = "$project.name" + url = 'https://openrndr.org' + developers { + developer { + id = 'edwinjakobs' + name = 'Edwin Jakobs' + email = 'edwin@openrndr.org' + } + } + license { + licenses { + license { + name = 'BSD-2-Clause' + url = 'https://github.com/openrndr/openrndr/blob/master/LICENSE' + distribution = 'repo' + } + } + } + scm { + connection = "scm:git:git@github.com:openrndr/openrndr.git" + developerConnection = "scm:git:ssh://github.com/openrndr/openrndr.git" + url = "https://github.com/openrndr/openrndr" + } + } + } + } + repositories { + maven { + credentials { + username findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME") + password findProperty("ossrhPassword") ?: System.getenv("OSSRH_PASSWORD") + } + if (!isReleaseVersion) { + url "https://s01.oss.sonatype.org/content/repositories/snapshots" + } else { + url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2" + } + } + } + } + signing { + required { isReleaseVersion && gradle.taskGraph.hasTask("publish") } + sign publishing.publications + } + +} + +configure(allprojects.findAll { !doNotPublish.contains(it.name) && !multiplatformModules.contains(it.name) }) { // apply plugin: 'idea' apply plugin: 'java' apply plugin: 'kotlin' apply plugin: 'maven-publish' + apply plugin: 'nebula.release' + apply plugin: 'signing' - + def proj = it + println proj + java { + withJavadocJar() + withSourcesJar() + } publishing { publications { maven(MavenPublication) { from components.java + groupId = "org.openrndr.extra" + artifactId = "$project.name" + description = "$project.name" + pom { + name = "$project.name" + description = "$project.name" + url = 'https://openrndr.org' + developers { + developer { + id = 'edwinjakobs' + name = 'Edwin Jakobs' + email = 'edwin@openrndr.org' + } + } + license { + licenses { + license { + name = 'BSD-2-Clause' + url = 'https://github.com/openrndr/orx/blob/master/LICENSE' + distribution = 'repo' + } + } + } + scm { + connection = "scm:git:git@github.com:openrndr/orx.git" + developerConnection = "scm:git:ssh://github.com/openrndr/orx.git" + url = "https://github.com/openrndr/orx" + } + } } } + repositories { + maven { + credentials { + username findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME") + password findProperty("ossrhPassword") ?: System.getenv("OSSRH_PASSWORD") + } + if (!isReleaseVersion) { + url "https://s01.oss.sonatype.org/content/repositories/snapshots" + } else { + url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2" + } + } + } + + } + signing { + required { isReleaseVersion && gradle.taskGraph.hasTask("publish") } + sign publishing.publications } dependencies { @@ -214,6 +331,7 @@ configure(allprojects.findAll { !multiplatformModules.contains(it.name) }) { testRuntimeOnly "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion" } + test { useJUnitPlatform { includeEngines 'spek2' @@ -234,10 +352,10 @@ configure(allprojects.findAll { !multiplatformModules.contains(it.name) }) { } } -configure(allprojects.findAll { it.name != "openrndr-demos" }) { - apply plugin: 'maven-publish' - apply plugin: 'nebula.release' -} +//configure(allprojects.findAll { it.name != "openrndr-demos" }) { +// apply plugin: 'maven-publish' +// apply plugin: 'nebula.release' +//} //collectScreenshots.dependsOn { diff --git a/openrndr-demos/build.gradle b/openrndr-demos/build.gradle index ee4fa1443..71ad40005 100644 --- a/openrndr-demos/build.gradle +++ b/openrndr-demos/build.gradle @@ -1,3 +1,5 @@ +apply plugin: 'java' +apply plugin: 'kotlin' sourceSets { demo { java {