diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5e971de..fca8c40 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -48,15 +48,19 @@ jobs: with: distribution: 'temurin' java-version: '17' - cache: 'gradle' + + - name: Setup Gradle 8.14 + uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: '8.14' - name: Gradle Wrapper - run: gradle wrapper + run: gradle wrapper --gradle-version=8.14 - name: Publish with Gradle env: - ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }} - ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} - OSSRH_USERNAME: ${{ secrets.MAVEN_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} - run: ./gradlew lexfloatclient:publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository -PlexVersion=${{github.event.inputs.packageVersion}} --info --warning-mode all + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_PRIVATE_KEY_ARMORED }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSPHRASE }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_PASSWORD }} + run: ./gradlew lexfloatclient:publishAndReleaseToMavenCentral -PlexVersion=${{github.event.inputs.packageVersion}} --info --warning-mode all diff --git a/.github/workflows/test-publish.yml b/.github/workflows/test-publish.yml index bbd698c..e49113f 100644 --- a/.github/workflows/test-publish.yml +++ b/.github/workflows/test-publish.yml @@ -25,4 +25,4 @@ jobs: run: gradle wrapper - name: Publish with Gradle - run: ./gradlew lexfloatclient:publishTestPublicationToMavenLocal --info --warning-mode all \ No newline at end of file + run: ./gradlew lexfloatclient:publishToMavenLocal --info --warning-mode all --dry-run \ No newline at end of file diff --git a/build.gradle b/build.gradle index 89ca042..070bdf7 100644 --- a/build.gradle +++ b/build.gradle @@ -8,10 +8,6 @@ buildscript { } } -plugins { - id "io.github.gradle-nexus.publish-plugin" version "1.3.0" -} - if (project.hasProperty("lexVersion")) { project.setVersion(lexVersion) } @@ -19,20 +15,6 @@ ext { PUBLISH_GROUP_ID = 'com.cryptlex.android.lexfloatclient' PUBLISH_ARTIFACT_ID = 'lexfloatclient' PUBLISH_VERSION = version - OSSRH_USERNAME = System.getenv('OSSRH_USERNAME') - OSSRH_PASSWORD = System.getenv('OSSRH_PASSWORD') -} - -nexusPublishing { - repositories { - sonatype { - stagingProfileId = "24cd3440581936" - nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) - snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) - username = OSSRH_USERNAME - password = OSSRH_PASSWORD - } - } } group = "com.cryptlex.android.lexfloatclient" diff --git a/lexfloatclient/build.gradle b/lexfloatclient/build.gradle index e3d317d..e00aa8e 100644 --- a/lexfloatclient/build.gradle +++ b/lexfloatclient/build.gradle @@ -1,7 +1,6 @@ plugins { id 'com.android.library' - id 'maven-publish' - id 'signing' + id 'com.vanniktech.maven.publish' version '0.34.0' } android { @@ -23,74 +22,50 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } - publishing { - singleVariant("release") { - withSourcesJar() - withJavadocJar() - } - } - namespace 'com.cryptlex.android.lexfloatclient' } +repositories { + mavenCentral() +} + dependencies { implementation 'net.java.dev.jna:jna:5.13.0@aar' implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2' } -publishing { - publications { - release(MavenPublication) { - groupId PUBLISH_GROUP_ID - artifactId PUBLISH_ARTIFACT_ID - version PUBLISH_VERSION - afterEvaluate { - from components.release - pom { - name = 'LexFloatClient' - description = 'LexFloatClient wrapper for Android (licensing library).' - url = 'https://github.com/cryptlex/lexfloatclient-android' - licenses { - license { - name = 'MIT License' - url = 'http://www.opensource.org/licenses/mit-license.php' - } - } - organization { - name = 'Cryptlex, LLC' - url = 'https://cryptlex.com' - } - developers { - developer { - name = 'Cryptlex Team' - email = 'support@cryptlex.com' - organization = 'Cryptlex, LLC.' - organizationUrl = 'https://cryptlex.com' - } - } - scm { - connection = 'scm:git:https://github.com/cryptlex/lexfloatclient-android.git' - developerConnection = 'scm:git:ssh://github.com/cryptlex/lexfloatclient-android.git' - url = 'https://github.com/cryptlex/lexfloatclient-android' - } - } - } - } - - test(MavenPublication) { - groupId PUBLISH_GROUP_ID - artifactId PUBLISH_ARTIFACT_ID - version PUBLISH_VERSION - afterEvaluate { - from components.release - } - } - } -} - -signing { - def signingKey = findProperty("signingKey") - def signingPassword = findProperty("signingPassword") - useInMemoryPgpKeys(signingKey, signingPassword) - sign publishing.publications.release -} +mavenPublishing { + publishToMavenCentral(true) + signAllPublications() + + coordinates(PUBLISH_GROUP_ID, PUBLISH_ARTIFACT_ID, PUBLISH_VERSION) + + pom { + name = 'LexFloatClient' + description = 'LexFloatClient wrapper for Android (licensing library).' + url = 'https://github.com/cryptlex/lexfloatclient-android' + licenses { + license { + name = 'MIT License' + url = 'http://www.opensource.org/licenses/mit-license.php' + } + } + organization { + name = 'Cryptlex, LLP' + url = 'https://cryptlex.com' + } + developers { + developer { + name = 'Cryptlex Team' + email = 'support@cryptlex.com' + organization = 'Cryptlex, LLP.' + organizationUrl = 'https://cryptlex.com' + } + } + scm { + connection = 'scm:git:https://github.com/cryptlex/lexfloatclient-android.git' + developerConnection = 'scm:git:ssh://github.com/cryptlex/lexfloatclient-android.git' + url = 'https://github.com/cryptlex/lexfloatclient-android' + } + } +} \ No newline at end of file diff --git a/lexfloatclient/maven-central.gradle b/lexfloatclient/maven-central.gradle deleted file mode 100644 index efa0a69..0000000 --- a/lexfloatclient/maven-central.gradle +++ /dev/null @@ -1,86 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'signing' - -task androidJavadocs(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - android.libraryVariants.all { variant -> - if (variant.name == 'release') { - owner.classpath += variant.javaCompileProvider.get().classpath - } - } - exclude '**/R.html', '**/R.*.html', '**/index.html' -} - -task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { - archiveClassifier.set('javadoc') - from androidJavadocs.destinationDir -} - -task androidSourcesJar(type: Jar) { - archiveClassifier.set('sources') - from android.sourceSets.main.java.srcDirs -} - -afterEvaluate{project -> - publishing { - publications { - release( MavenPublication ) { - - groupId PUBLISH_GROUP_ID - artifactId PUBLISH_ARTIFACT_ID - version PUBLISH_VERSION - - artifact bundleReleaseAar - artifact androidJavadocsJar - artifact androidSourcesJar - - pom { - name = 'LexFloatClient' - description = 'LexFloatClient wrapper for Android (licensing library).' - url = 'https://github.com/cryptlex/lexfloatclient-android' - licenses { - license { - name = 'MIT License' - url = 'http://www.opensource.org/licenses/mit-license.php' - } - } - organization { - name = 'Cryptlex, LLC' - url = 'https://cryptlex.com' - } - developers { - developer { - name = 'Cryptlex Team' - email = 'support@cryptlex.com' - organization = 'Cryptlex, LLC.' - organizationUrl = 'https://cryptlex.com' - } - } - scm { - connection = 'scm:git:https://github.com/cryptlex/lexfloatclient-android.git' - developerConnection = 'scm:git:ssh://github.com/cryptlex/lexfloatclient-android.git' - url = 'https://github.com/cryptlex/lexfloatclient-android' - } - withXml { - def dependenciesNode = asNode().appendNode('dependencies') - - project.configurations.implementation.allDependencies.each { - def dependencyNode = dependenciesNode.appendNode('dependency') - dependencyNode.appendNode('groupId', it.group) - dependencyNode.appendNode('artifactId', it.name) - dependencyNode.appendNode('version', it.version) - } - } - } - } - } - } -} - -signing { - def signingKey = findProperty("signingKey") - def signingPassword = findProperty("signingPassword") - useInMemoryPgpKeys(signingKey, signingPassword) - sign publishing.publications -}