diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index db12b94..2842adc 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -9,21 +9,28 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 + - name: set up JDK 17 - uses: actions/setup-java@v4 + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #v4.2.1 with: java-version: '17' distribution: 'temurin' cache: gradle - name: Setup Android SDK - uses: android-actions/setup-android@v3 + uses: android-actions/setup-android@00854ea68c109d98c75d956347303bf7c45b0277 #v3.2.1 - name: Grant execute permission for gradlew run: chmod +x gradlew + - name: Build with Gradle run: ./gradlew build + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_TOKEN }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSPHRASE }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3872a42..6531b39 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ on: jobs: release: name: Release - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout step uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 @@ -33,9 +33,3 @@ jobs: ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }} ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSPHRASE }} run: ./gradlew publish - - - name: Gradle Close and Release Repository - env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_TOKEN }} - run: ./gradlew closeAndReleaseRepository diff --git a/build.gradle.kts b/build.gradle.kts index c85ab58..73887a6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,5 +4,4 @@ plugins { id("org.jetbrains.kotlin.android") version "2.0.0" apply false id("com.android.library") version "8.5.1" apply false id("com.google.dagger.hilt.android") version "2.51.1" apply false - id("com.vanniktech.maven.publish") version "0.29.0" apply false } diff --git a/passwordless/build.gradle.kts b/passwordless/build.gradle.kts index b0f7102..4905b63 100644 --- a/passwordless/build.gradle.kts +++ b/passwordless/build.gradle.kts @@ -1,10 +1,8 @@ -import com.vanniktech.maven.publish.AndroidSingleVariantLibrary -import com.vanniktech.maven.publish.SonatypeHost - plugins { id("com.android.library") id("org.jetbrains.kotlin.android") - id("com.vanniktech.maven.publish") + id("maven-publish") + id("signing") } android { @@ -46,52 +44,11 @@ android { jvmTarget = "1.8" } - mavenPublishing { - coordinates("com.bitwarden", "passwordless-android", project.version.toString()) - // publishToMavenCentral(SonatypeHost.DEFAULT) - publishToMavenCentral(SonatypeHost.S01) - signAllPublications() - - pom { - name.set("Passwordless Android Client SDK") - description.set("Passwordless Android Client SDK allows you to integrate Passwordless into your Android application.") - inceptionYear.set("2024") - url.set("https://www.github.com/bitwarden/passwordless-android/") - licenses { - license { - name.set("The Apache License, Version 2.0") - url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") - distribution.set("http://www.apache.org/licenses/LICENSE-2.0.txt") - } - } - developers { - developer { - id.set("jonashendrickx") - name.set("Jonas Hendrickx") - organization.set("Bitwarden") - organizationUrl.set("https://github.com/bitwarden") - url.set("https://github.com/jonashendrickx") - } - } - scm { - url.set("https://github.com/bitwarden/passwordless-android") - connection.set("scm:git:git@github.com:passwordless/passwordless-android.git") - developerConnection.set("scm:git:git@github.com:bitwarden/passwordless-android.git") - } + publishing { + singleVariant("release") { + withSourcesJar() + withJavadocJar() } - - configure( - AndroidSingleVariantLibrary( - // the published variant - variant = "release", - - // whether to publish a sources jar - sourcesJar = true, - - // whether to publish a javadoc jar - publishJavadocJar = true, - ) - ) } } @@ -114,3 +71,70 @@ dependencies { androidTestImplementation(libs.espresso.core) androidTestImplementation(libs.mockito.core) } + +publishing { + publications { + register("release") { + groupId = "com.bitwarden" + artifactId = "passwordless-android" + version = project.version.toString() + + afterEvaluate { + from(components["release"]) + } + + pom { + name = "Passwordless Android Client SDK" + description = "Passwordless Android Client SDK allows you to integrate Passwordless into your Android application." + url = "https://www.github.com/bitwarden/passwordless-android/" + inceptionYear = "2024" + + licenses { + license { + name = "GNU General Public License (GPL) v3.0" + url = "https://github.com/bitwarden/passwordless-android/blob/main/LICENSE_GPL.txt" + distribution = "https://github.com/bitwarden/passwordless-android/blob/main/LICENSE_GPL.txt" + } + } + + developers { + developer { + id = "jonashendrickx" + name = "Jonas Hendrickx" + organization = "Bitwarden" + organizationUrl = "https://github.com/bitwarden" + url = "https://github.com/jonashendrickx" + } + } + + scm { + url = "https://github.com/bitwarden/passwordless-android" + connection = "scm:git:git@github.com:bitwarden/passwordless-android.git" + developerConnection = "scm:git:git@github.com:bitwarden/passwordless-android.git" + } + } + } + } + + repositories { + maven { + name = "S01" + val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") + val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") + url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl + + credentials { + username = System.getenv("ORG_GRADLE_PROJECT_mavenCentralUsername") ?: throw Exception("'ORG_GRADLE_PROJECT_mavenCentralUsername' is missing.") + password = System.getenv("ORG_GRADLE_PROJECT_mavenCentralPassword") ?: throw Exception("'ORG_GRADLE_PROJECT_mavenCentralPassword' is missing.") + } + } + } +} + +signing { + useInMemoryPgpKeys( + System.getenv("ORG_GRADLE_PROJECT_signingInMemoryKey"), + System.getenv("ORG_GRADLE_PROJECT_signingInMemoryKeyPassword") + ) + sign(publishing.publications) +}