Skip to content

Commit

Permalink
feat: publish via Maven Central Portal instead
Browse files Browse the repository at this point in the history
Turns out that the old OSSRH portal is deprecated and I can't create a new namespace under it.
  • Loading branch information
rushiiMachine committed Feb 20, 2025
1 parent bf95c61 commit 8ce20f8
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 69 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ jobs:

- name: Build & Publish to Maven
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLED: true
run: |
chmod +x ./gradlew
./gradlew :lib:publishToMavenLocal :lib:publish --stacktrace --no-daemon
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
plugins {
alias(libs.plugins.android.library) apply false
alias(libs.plugins.publish) apply false
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[versions]
agp = "8.8.1"
publish = "0.30.0"

[libraries]

[plugins]
android-library = { id = "com.android.library", version.ref = "agp" }
publish = { id = "com.vanniktech.maven.publish", version.ref = "publish" }
86 changes: 24 additions & 62 deletions lib/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@file:Suppress("UnstableApiUsage")

import com.vanniktech.maven.publish.SonatypeHost


plugins {
id("signing")
id("maven-publish")
alias(libs.plugins.android.library)
alias(libs.plugins.publish)
}

android {
Expand Down Expand Up @@ -55,72 +57,32 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}
}

publishing {
publications {
register<MavenPublication>("libunbound") {
artifactId = "libunbound"
group = "dev.rushii"
version = "1.0.0"

pom {
name.set("LibUnbound")
description.set("Android native library for interfacing with compiled hermes dynamically ")
url.set("https://github.com/unbound-app/libunbound-android")
licenses {
license {
name.set("GNU Lesser General Public License v3.0")
url.set("https://github.com/unbound-app/libunbound-android/LICENSE")
}
}
developers {
developer {
name = "rushii"
url = "https://github.com/rushiiMachine"
}
}
scm {
connection.set("scm:git:https://github.com/unbound-app/libunbound-android.git")
url.set("https://github.com/unbound-app/libunbound-android")
}
}
mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
coordinates("dev.rushii", "libunbound", "1.0.0")

afterEvaluate {
from(components.getByName("release"))
pom {
name = "LibUnbound"
description = "Android native library for interfacing with compiled hermes dynamically"
inceptionYear = "2025"
url = "https://github.com/unbound-app/libunbound-android"
licenses {
license {
name = "GNU Lesser General Public License v3.0"
url = "https://github.com/unbound-app/libunbound-android/blob/master/LICENSE"
}
}
}
repositories {
val sonatypeUsername = System.getenv("SONATYPE_USERNAME")
val sonatypePassword = System.getenv("SONATYPE_PASSWORD")

if (sonatypeUsername == null || sonatypePassword == null)
mavenLocal()
else {
signing {
useInMemoryPgpKeys(
System.getenv("SIGNING_KEY_ID"),
System.getenv("SIGNING_KEY"),
System.getenv("SIGNING_PASSWORD"),
)
sign(publishing.publications)
}

maven {
credentials {
username = sonatypeUsername
password = sonatypePassword
}
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
developers {
developer {
name = "rushii"
url = "https://github.com/rushiiMachine"
}
}
scm {
url = "https://github.com/unbound-app/libunbound-android"
connection = "scm:git:https://github.com/unbound-app/libunbound-android.git"
}
}
}
4 changes: 2 additions & 2 deletions lib/src/main/java/dev/rushii/libunbound/LibUnbound.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* JNI interface to the native side of this library.
* This class can only be loaded after the Hermes native library ({@code libhermes.so}) has been loaded into the process.
* If Hermes has not yet been loaded, a {@link RuntimeException} will be thrown upon loading this class.
*/
@SuppressWarnings("unused")
public class LibUnbound {
Expand All @@ -15,10 +17,8 @@ public class LibUnbound {

/**
* Obtains the Hermes Bytecode (HBC) version that the Hermes runtime supports.
* This method can only be called after the Hermes native lib has been loaded into the process.
*
* @throws IllegalStateException If Hermes has not yet been loaded.
* @throws RuntimeException If failing to find the required native symbol.
*/
public static int getHermesRuntimeBytecodeVersion() {
if (cachedBytecodeVersion > 0)
Expand Down

0 comments on commit 8ce20f8

Please sign in to comment.