Skip to content

Commit e9e3cec

Browse files
committed
Fix publish to maven process
1 parent 61bcfb5 commit e9e3cec

4 files changed

Lines changed: 82 additions & 86 deletions

File tree

.github/workflows/publish-snapshot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Release build
2121
run: ./gradlew assemble --scan
2222
- name: Source jar and dokka
23-
run: ./gradlew androidSourcesJar javadocJar --scan
23+
run: ./gradlew javadocJar --scan
2424
- name: Publish to MavenCentral
2525
run: ./gradlew publishReleasePublicationToSonatypeRepository --scan
2626
env:

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Release build
2020
run: ./gradlew assemble --scan
2121
- name: Source jar and dokka
22-
run: ./gradlew androidSourcesJar javadocJar --scan
22+
run: ./gradlew javadocJar --scan
2323
- name: Publish to MavenCentral
2424
run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository --scan
2525
env:

scripts/publish-module.gradle

Lines changed: 59 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2,84 +2,80 @@ apply plugin: 'maven-publish'
22
apply plugin: 'signing'
33
apply plugin: 'org.jetbrains.dokka'
44

5-
task androidSourcesJar(type: Jar) {
6-
archiveClassifier.set('sources')
7-
if (project.plugins.findPlugin("com.android.library")) {
8-
from android.sourceSets.main.java.srcDirs
9-
from android.sourceSets.main.kotlin.srcDirs
10-
} else {
11-
from sourceSets.main.java.srcDirs
12-
from sourceSets.main.kotlin.srcDirs
5+
if (project.plugins.findPlugin("com.android.library")) {
6+
android {
7+
publishing {
8+
singleVariant("release") {
9+
withJavadocJar()
10+
withSourcesJar()
11+
}
1312
}
13+
}
14+
} else {
15+
java {
16+
withSourcesJar()
17+
withJavadocJar()
18+
}
1419
}
1520

1621
tasks.withType(dokkaHtmlPartial.getClass()).configureEach {
17-
pluginsMapConfiguration.set(
18-
["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""]
19-
)
20-
}
21-
22-
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
23-
archiveClassifier.set('javadoc')
24-
from dokkaJavadoc.outputDirectory
25-
}
26-
27-
artifacts {
28-
archives androidSourcesJar
29-
archives javadocJar
22+
pluginsMapConfiguration.set(
23+
["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""]
24+
)
3025
}
3126

3227
group = PUBLISH_GROUP_ID
3328
version = PUBLISH_VERSION
3429

3530
afterEvaluate {
36-
publishing {
37-
publications {
38-
release(MavenPublication) {
39-
groupId PUBLISH_GROUP_ID
40-
artifactId PUBLISH_ARTIFACT_ID
41-
version PUBLISH_VERSION
42-
if (project.plugins.findPlugin("com.android.library")) {
43-
from components.release
44-
} else {
45-
from components.java
46-
}
47-
48-
artifact androidSourcesJar
49-
artifact javadocJar
31+
publishing {
32+
publications {
33+
release(MavenPublication) {
34+
groupId PUBLISH_GROUP_ID
35+
artifactId PUBLISH_ARTIFACT_ID
36+
version PUBLISH_VERSION
37+
if (project.plugins.findPlugin("com.android.library")) {
38+
from components.release
39+
} else {
40+
from components.java
41+
}
5042

51-
pom {
52-
name = PUBLISH_ARTIFACT_ID
53-
description = 'Result and error models for standardizing responses on Kotlin and Android.'
54-
url = 'https://github.com/getstream/stream-result'
55-
licenses {
56-
license {
57-
name = 'The Apache Software License, Version 2.0'
58-
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
59-
}
60-
}
61-
developers {
62-
developer {
63-
id = 'skydoves'
64-
name = 'Jaewoong Eum'
65-
}
66-
}
67-
scm {
68-
connection = 'scm:git:github.com/getstream/stream-result.git'
69-
developerConnection = 'scm:git:ssh://github.com/getstream/stream-result.git'
70-
url = 'https://github.com/getstream/stream-result/tree/main'
71-
}
72-
}
43+
pom {
44+
name = PUBLISH_ARTIFACT_ID
45+
description = 'Result and error models for standardizing responses on Kotlin and Android.'
46+
url = 'https://github.com/getstream/stream-result'
47+
licenses {
48+
license {
49+
name = 'The Apache Software License, Version 2.0'
50+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
51+
}
52+
}
53+
developers {
54+
developer {
55+
id = 'jcminarro'
56+
name = 'Jc Miñarro'
57+
}
58+
developer {
59+
id = 'skydoves'
60+
name = 'Jaewoong Eum'
7361
}
62+
}
63+
scm {
64+
connection = 'scm:git:github.com/getstream/stream-result.git'
65+
developerConnection = 'scm:git:ssh://github.com/getstream/stream-result.git'
66+
url = 'https://github.com/getstream/stream-result/tree/main'
67+
}
7468
}
69+
}
7570
}
71+
}
7672
}
7773

7874
signing {
79-
useInMemoryPgpKeys(
80-
rootProject.ext["signing.keyId"],
81-
rootProject.ext["signing.key"],
82-
rootProject.ext["signing.password"],
83-
)
84-
sign publishing.publications
75+
useInMemoryPgpKeys(
76+
rootProject.ext["signing.keyId"],
77+
rootProject.ext["signing.key"],
78+
rootProject.ext["signing.password"],
79+
)
80+
sign publishing.publications
8581
}

scripts/publish-root.gradle

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,35 @@ ext["snapshot"] = ''
1111

1212
File secretPropsFile = project.rootProject.file('local.properties')
1313
if (secretPropsFile.exists()) {
14-
// Read local.properties file first if it exists
15-
Properties p = new Properties()
16-
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
17-
p.each { name, value -> ext[name] = value }
14+
// Read local.properties file first if it exists
15+
Properties p = new Properties()
16+
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
17+
p.each { name, value -> ext[name] = value }
1818
} else {
19-
// Use system environment variables
20-
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
21-
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
22-
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
23-
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
24-
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
25-
ext["signing.key"] = System.getenv('SIGNING_KEY')
26-
ext["snapshot"] = System.getenv('SNAPSHOT')
19+
// Use system environment variables
20+
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
21+
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
22+
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
23+
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
24+
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
25+
ext["signing.key"] = System.getenv('SIGNING_KEY')
26+
ext["snapshot"] = System.getenv('SNAPSHOT')
2727
}
2828

2929
if (snapshot) {
30-
ext["rootVersionName"] = Configurations.snapshotVersionName
30+
ext["rootVersionName"] = Configurations.snapshotVersionName
3131
} else {
32-
ext["rootVersionName"] = Configurations.versionName
32+
ext["rootVersionName"] = Configurations.versionName
3333
}
3434

3535
// Set up Sonatype repository
3636
nexusPublishing {
37-
repositories {
38-
sonatype {
39-
stagingProfileId = sonatypeStagingProfileId
40-
username = ossrhUsername
41-
password = ossrhPassword
42-
version = rootVersionName
43-
}
37+
repositories {
38+
sonatype {
39+
stagingProfileId = sonatypeStagingProfileId
40+
username = ossrhUsername
41+
password = ossrhPassword
42+
version = rootVersionName
4443
}
44+
}
4545
}

0 commit comments

Comments
 (0)