1
- import java.util.Properties
1
+ import java.util.Base64
2
2
3
3
plugins {
4
4
id(" com.android.library" ) version " 8.0.1"
5
5
id(" maven-publish" )
6
- // id("signing")
6
+ id(" signing" )
7
7
}
8
8
9
9
group = " co.powersync"
@@ -52,19 +52,6 @@ tasks.named("preBuild") {
52
52
dependsOn(buildRust)
53
53
}
54
54
55
- val secretsFile = rootProject.file(" local.properties" )
56
- val secretProperties = Properties ()
57
-
58
- if (secretsFile.exists()) {
59
- secretsFile.reader().use { secretProperties.load(it) }
60
-
61
- secretProperties.forEach { key, value ->
62
- if (key is String && key.startsWith(" signing" )) {
63
- ext[key] = value
64
- }
65
- }
66
- }
67
-
68
55
publishing {
69
56
publications {
70
57
register<MavenPublication >(" maven" ) {
@@ -106,19 +93,14 @@ publishing {
106
93
}
107
94
108
95
repositories {
109
- // maven {
110
- // name = "sonatype"
111
- // url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
112
- // credentials {
113
- // username = secretProperties.getProperty("ossrhUsername")
114
- // password = secretProperties.getProperty("ossrhPassword")
115
- // }
116
- // }
117
- //
118
- // maven {
119
- // name = "here"
120
- // url = uri("build/here/")
121
- // }
96
+ maven {
97
+ name = " sonatype"
98
+ url = uri(" https://oss.sonatype.org/service/local/staging/deploy/maven2/" )
99
+ credentials {
100
+ username = System .getenv(" OSSRH_USERNAME" )
101
+ password = System .getenv(" OSSRH_PASSWORD" )
102
+ }
103
+ }
122
104
123
105
maven {
124
106
name = " GitHubPackages"
@@ -130,11 +112,17 @@ publishing {
130
112
}
131
113
}
132
114
}
133
- //
134
- // signing {
135
- // useGpgCmd()
136
- // sign(publishing.publications)
137
- // }
115
+
116
+ signing {
117
+ if (System .getenv(" GPG_PRIVATE_KEY" ) == null ) {
118
+ useGpgCmd()
119
+ } else {
120
+ var signingKey = String (Base64 .getDecoder().decode(System .getenv(" GPG_PRIVATE_KEY" ))).trim()
121
+ var signingPassword = System .getenv(" GPG_PASSWORD" )
122
+ useInMemoryPgpKeys(signingKey, signingPassword)
123
+ }
124
+ sign(publishing.publications)
125
+ }
138
126
139
127
tasks.withType<AbstractPublishToMaven >() {
140
128
dependsOn(" assembleRelease" )
0 commit comments