Skip to content

Commit 23725ee

Browse files
committed
Configure maven publish
1 parent b6f654d commit 23725ee

51 files changed

Lines changed: 183 additions & 18185 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/publish.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish all modules to Maven Central
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # triggers on version tags, e.g., v1.0.0
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout source
14+
uses: actions/checkout@v4
15+
16+
- name: Set up JDK 21
17+
uses: actions/setup-java@v4
18+
with:
19+
distribution: temurin
20+
java-version: 21
21+
cache: gradle
22+
23+
- name: Setup Gradle
24+
uses: gradle/actions/setup-gradle@v3
25+
26+
- name: Import GPG key
27+
run: |
28+
echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import
29+
env:
30+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
31+
32+
- name: Publish to Maven Central (all modules)
33+
run: ./gradlew clean publishToSonatype closeAndReleaseSonatypeStagingRepository --stacktrace
34+
env:
35+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
36+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
37+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
38+
GPG_PRIVATE_KEY_PASSWORD: ${{ secrets.GPG_PRIVATE_KEY_PASSWORD }}

build.gradle.kts

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,63 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
1+
import io.github.gradlenexus.publishplugin.NexusPublishExtension
2+
import org.gradle.api.publish.PublishingExtension
3+
import org.gradle.plugins.signing.SigningExtension
4+
25
plugins {
36
alias(libs.plugins.kotlin.android) apply false
47
alias(libs.plugins.android.library) apply false
58
alias(libs.plugins.jetbrains.kotlin.jvm) apply false
69
alias(libs.plugins.versions.plugin)
10+
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
711
}
812

913
tasks.register<Delete>("clean") {
1014
delete(rootProject.layout.buildDirectory)
1115
}
16+
17+
configure<NexusPublishExtension> {
18+
repositories {
19+
sonatype {
20+
username.set(System.getenv("OSSRH_USERNAME"))
21+
password.set(System.getenv("OSSRH_PASSWORD"))
22+
}
23+
}
24+
}
25+
26+
subprojects {
27+
plugins.withId("maven-publish") {
28+
29+
// 🔹 Configure Maven repositories
30+
extensions.configure<PublishingExtension> {
31+
repositories {
32+
mavenLocal()
33+
34+
maven {
35+
name = "OSSRH"
36+
url = uri(
37+
if (version.toString().endsWith("SNAPSHOT"))
38+
"https://s01.oss.sonatype.org/content/repositories/snapshots/"
39+
else
40+
"https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
41+
)
42+
credentials {
43+
username = System.getenv("OSSRH_USERNAME")
44+
password = System.getenv("OSSRH_PASSWORD")
45+
}
46+
}
47+
}
48+
}
49+
50+
project.plugins.withId("signing") {
51+
project.extensions.configure<SigningExtension> {
52+
val publishing = project.extensions.findByType(PublishingExtension::class.java)
53+
if (publishing != null) {
54+
useInMemoryPgpKeys(
55+
System.getenv("GPG_PRIVATE_KEY"),
56+
System.getenv("GPG_PRIVATE_KEY_PASSWORD")
57+
)
58+
sign(publishing.publications)
59+
}
60+
}
61+
}
62+
}
63+
}

gradle/libs.versions.toml

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
[versions]
2-
peraWalletConnect = "1.0.6"
2+
peraWalletConnect = "1.0.7"
33
minSdk = "24"
44
compileSdk = "36"
55
targetSdk = "36"
66

77
agp = "8.13.0"
88
kotlin = "2.1.0"
9-
coreKtx = "1.17.0"
10-
junit = "4.13.2"
11-
junitVersion = "1.3.0"
12-
espressoCore = "3.7.0"
13-
appcompat = "1.7.1"
14-
material = "1.13.0"
159

1610
# Libraries
1711
moshi = "1.15.2"
@@ -20,9 +14,7 @@ gson = "2.13.2"
2014
khex = "1.1.2"
2115
bcprov = "1.82"
2216

23-
core = "1.7.0"
2417
ksp = "2.1.0-1.0.29"
25-
mockkAndroid = "1.14.6"
2618

2719
coroutines = "1.10.2"
2820
sqlDelight = "2.1.0"
@@ -31,27 +23,16 @@ koin = "4.1.1"
3123
retrofit = "3.0.0"
3224
sqlCipher = "4.11.0"
3325
multibase = "1.1.1"
34-
json = "20250517"
3526
timber = "5.0.1"
3627
web3j = "5.0.1"
3728
kethereum = "0.86.0"
3829
relinker = "1.4.5"
3930

4031
firebaseBOM = "34.4.0"
4132

42-
androidxTest = "1.7.0"
43-
androidxTestOrchestration = "1.6.1"
4433
androidxSecurity = "1.1.0"
4534

46-
robolectric = "4.16"
47-
4835
[libraries]
49-
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
50-
junit = { group = "junit", name = "junit", version.ref = "junit" }
51-
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
52-
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
53-
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
54-
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
5536

5637
# Core
5738
moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" }
@@ -61,33 +42,21 @@ bcprov = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bcprov" }
6142
khex-core = { module = "com.github.komputing.khex:core", version.ref = "khex" }
6243
khex-extensions = { module = "com.github.komputing.khex:extensions", version.ref = "khex" }
6344

64-
65-
core = { module = "androidx.test:core", version.ref = "core" }
66-
mockk-android = { module = "io.mockk:mockk-android", version.ref = "mockkAndroid" }
6745
sqlDelight-android = { module = "app.cash.sqldelight:android-driver", version.ref = "sqlDelight" }
6846
sqlDelight-coroutines = { module = "app.cash.sqldelight:coroutines-extensions", version.ref = "sqlDelight" }
6947
sqlDelight-adapters = { module = "app.cash.sqldelight:primitive-adapters", version.ref = "sqlDelight" }
70-
sqlDelight-test = { module = "app.cash.sqldelight:sqlite-driver", version.ref = "sqlDelight" }
7148
sqlDelight-async = { module = "app.cash.sqldelight:async-extensions", version.ref = "sqlDelight" }
72-
sqlite-jdbc = { module = "org.xerial:sqlite-jdbc", version = "3.50.3.0" }
7349

7450
androidx-security = { module = "androidx.security:security-crypto-ktx", version.ref = "androidxSecurity" }
75-
androidx-testJunit = { module = "androidx.test.ext:junit-ktx", version = "1.3.0" }
76-
androidx-testCore = { module = "androidx.test:core-ktx", version.ref = "androidxTest" }
77-
androidx-testOrchestrator = { module = "androidx.test:orchestrator", version.ref = "androidxTestOrchestration" }
78-
androidx-testRunner = { module = "androidx.test:runner", version = "1.7.0" }
79-
androidx-testRules = { module = "androidx.test:rules", version.ref = "androidxTest" }
51+
8052
#-------------------------- Compose --------------------------
8153
coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
82-
coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
8354

8455
scarlet = { module = "com.walletconnect.Scarlet:scarlet", version.ref = "scarlet" }
8556
scarlet-okhttp = { module = "com.walletconnect.Scarlet:websocket-okhttp", version.ref = "scarlet" }
8657
scarlet-coroutines = { module = "com.walletconnect.Scarlet:stream-adapter-coroutines", version.ref = "scarlet" }
8758
scarlet-moshi = { module = "com.walletconnect.Scarlet:message-adapter-moshi", version.ref = "scarlet" }
8859
scarlet-android = { module = "com.walletconnect.Scarlet:lifecycle-android", version.ref = "scarlet" }
89-
scarlet-mockwebserver = { module = "com.walletconnect.Scarlet:websocket-mockwebserver", version.ref = "scarlet" }
90-
scarlet-testUtils = { module = "com.walletconnect.Scarlet:test-utils", version.ref = "scarlet" }
9160

9261
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
9362
retrofit-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit" }
@@ -98,7 +67,6 @@ moshi-ksp = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref =
9867
okhttp-logging = { module = "com.squareup.okhttp3:logging-interceptor", version.ref="okhttp" }
9968

10069
koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" }
101-
koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin" }
10270

10371
kethereum-bip39 = { module = "com.github.komputing.kethereum:bip39", version.ref = "kethereum" }
10472
kethereum-bip39-wordlist = { module = "com.github.komputing.kethereum:bip39_wordlist_en", version.ref = "kethereum" }
@@ -113,26 +81,18 @@ firebase-messaging = { module = "com.google.firebase:firebase-messaging" }
11381
sqlCipher = { module = "net.zetetic:sqlcipher-android", version.ref = "sqlCipher" }
11482
relinker = { module = "com.getkeepsafe.relinker:relinker", version.ref = "relinker" }
11583
mulitbase = { module = "com.github.multiformats:java-multibase", version.ref = "multibase" }
116-
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }
117-
json = { module = "org.json:json", version.ref = "json" }
11884
timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" }
11985
web3jCrypto = { module = "org.web3j:crypto", version.ref = "web3j" }
12086

12187
[bundles]
12288
sqlDelight = ["sqlDelight-android", "sqlDelight-coroutines", "sqlDelight-adapters", "sqlDelight-async"]
123-
sqlDelight-test = ["sqlDelight-test", "sqlite-jdbc"]
124-
125-
androidxTest = ["androidx-testJunit", "androidx-testCore"]
126-
androidxAndroidTest = ["androidx-testCore", "androidx-testRunner", "androidx-testRules"]
12789

12890
scarlet = ["scarlet", "scarlet-okhttp", "scarlet-coroutines", "scarlet-moshi"]
129-
scarlet-test = ["scarlet-mockwebserver", "scarlet-testUtils"]
13091

13192
retrofit = ["retrofit", "retrofit-moshi"]
13293
kethereum = ["kethereum-bip39", "kethereum-bip39-wordlist", "kethereum-bip32", "kethereum-model", "kethereum-crypto"]
13394

13495
[plugins]
135-
android-application = { id = "com.android.application", version.ref = "agp" }
13696
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
13797
android-library = { id = "com.android.library", version.ref = "agp" }
13898
jetbrains-kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ dependencyResolutionManagement {
2020
}
2121
}
2222

23-
rootProject.name = "Pera Wallet Connect"
23+
rootProject.name = "PeraWalletConnect"
2424
include(":wallet-connect-v1")
2525
include(":wallet-connect-v2")

wallet-connect-v1/build.gradle.kts

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ import org.gradle.api.JavaVersion
33
plugins {
44
alias(libs.plugins.jetbrains.kotlin.jvm)
55
id("maven-publish")
6+
id("signing")
67
}
78

89
java {
910
sourceCompatibility = JavaVersion.VERSION_11
1011
targetCompatibility = JavaVersion.VERSION_11
12+
withSourcesJar()
13+
withJavadocJar()
1114
}
1215

1316
kotlin {
@@ -32,46 +35,53 @@ dependencies {
3235
implementation(libs.okhttp)
3336
}
3437

35-
afterEvaluate {
36-
publishing {
37-
publications {
38-
create<MavenPublication>("release") {
39-
from(components["java"])
38+
// ✅ PUBLISHING CONFIGURATION
39+
publishing {
40+
publications {
41+
create<MavenPublication>("release") {
42+
from(components["java"])
4043

41-
groupId = "com.github.perawallet"
42-
artifactId = "wallet-connect-v1"
43-
version = libs.versions.peraWalletConnect.get()
44+
groupId = "app.perawallet"
45+
artifactId = "pera-wallet-connect-v1"
46+
version = libs.versions.peraWalletConnect.get()
4447

45-
pom {
46-
name.set("Wallet Connect V1")
47-
description.set("WalletConnect V1 SDK (Kotlin Library)")
48-
url.set("https://github.com/perawallet/PeraWalletConnect")
48+
pom {
49+
name.set("Pera Wallet Connect V1")
50+
description.set("WalletConnect V1 SDK for Android")
51+
url.set("https://github.com/perawallet/PeraWalletConnect")
4952

50-
licenses {
51-
license {
52-
name.set("Apache License 2.0")
53-
url.set("https://www.apache.org/licenses/LICENSE-2.0")
54-
}
53+
licenses {
54+
license {
55+
name.set("Apache License 2.0")
56+
url.set("https://www.apache.org/licenses/LICENSE-2.0")
5557
}
58+
}
5659

57-
developers {
58-
developer {
59-
id.set("perawallet")
60-
name.set("Pera Wallet")
61-
}
60+
developers {
61+
developer {
62+
id.set("perawallet")
63+
name.set("Pera Wallet")
6264
}
65+
}
6366

64-
scm {
65-
connection.set("scm:git:git://github.com/perawallet/PeraWalletConnect.git")
66-
developerConnection.set("scm:git:ssh://github.com/perawallet/PeraWalletConnect.git")
67-
url.set("https://github.com/perawallet/PeraWalletConnect")
68-
}
67+
scm {
68+
connection.set("scm:git:git://github.com/perawallet/PeraWalletConnect.git")
69+
developerConnection.set("scm:git:ssh://github.com/perawallet/PeraWalletConnect.git")
70+
url.set("https://github.com/perawallet/PeraWalletConnect")
6971
}
7072
}
7173
}
74+
}
75+
}
76+
77+
afterEvaluate {
78+
extensions.findByType<SigningExtension>()?.apply {
79+
val key = System.getenv("GPG_PRIVATE_KEY")
80+
val password = System.getenv("GPG_PRIVATE_KEY_PASSWORD")
7281

73-
repositories {
74-
mavenLocal()
82+
if (!key.isNullOrBlank() && !password.isNullOrBlank()) {
83+
useInMemoryPgpKeys(key, password)
84+
sign(publishing.publications)
7585
}
7686
}
7787
}

0 commit comments

Comments
 (0)