Skip to content

Commit e2e889d

Browse files
committed
Move publishing to nexus-publish
1 parent 94258f3 commit e2e889d

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

.github/workflows/publish-release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
path: '~/.m2/repository/'
4141

4242
- name: Publish to the Snapshot Repository
43-
run: ./gradlew publishReleasePublicationToNexusRepository
43+
run: ./gradlew publishToSonatype closeAndReleaseStagingRepositories
4444
env:
4545
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
4646
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}

.github/workflows/publish-snapshot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
path: '~/.m2/repository/'
4242

4343
- name: Publish to the Snapshot Repository
44-
run: ./gradlew publishReleasePublicationToSnapshotRepository
44+
run: ./gradlew publishToSonatype
4545
env:
4646
ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }}
4747
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}

build.gradle.kts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ plugins {
44
kotlin("android") apply false
55
alias(libs.plugins.compose.compiler) apply false
66
alias(libs.plugins.detekt)
7+
alias(libs.plugins.nexus.publish)
78
cleanup
89
base
910
}
1011

1112
allprojects {
1213
val GROUP: String by project
1314
val VERSION: String by project
15+
val USE_SNAPSHOT: String? by project
1416
group = GROUP
15-
version = VERSION
17+
version = if (USE_SNAPSHOT.toBoolean()) "$VERSION-SNAPSHOT" else VERSION
1618
}
1719

1820
val detektFormatting = libs.detekt.formatting
@@ -30,3 +32,17 @@ subprojects {
3032
detektPlugins(detektFormatting)
3133
}
3234
}
35+
36+
val NEXUS_USERNAME: String? by project
37+
val NEXUS_PASSWORD: String? by project
38+
39+
nexusPublishing {
40+
repositories {
41+
sonatype {
42+
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
43+
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
44+
username.set(NEXUS_USERNAME)
45+
password.set(NEXUS_PASSWORD)
46+
}
47+
}
48+
}

gradle/libs.versions.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ espresso_core = "3.6.1"
1414
junit = "4.13.2"
1515
kotlin = "2.2.0"
1616
min_sdk_version = "23"
17+
nexus_publish = "2.0.0"
1718
target_sdk_version = "36"
1819

1920
[libraries]
@@ -40,4 +41,5 @@ kgp = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kot
4041

4142
[plugins]
4243
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
43-
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
44+
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
45+
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus_publish" }

0 commit comments

Comments
 (0)