File tree Expand file tree Collapse file tree 9 files changed +87
-22
lines changed
expediagroup-sdk-openapi-plugin
expediagroup-sdk-transport-okhttp Expand file tree Collapse file tree 9 files changed +87
-22
lines changed Original file line number Diff line number Diff line change 1+ name : Publish Snapshots
2+
3+ on :
4+ push :
5+ branches :
6+ - " mdwairi/configure-publish-tasks"
7+ workflow_dispatch :
8+ inputs :
9+ branch :
10+ description : " Branch name to release snapshots from"
11+ required : true
12+
13+ jobs :
14+ publish :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - name : Checkout repository
18+ uses : actions/checkout@v4
19+ with :
20+ ref : ${{ inputs.branch }}
21+
22+ - name : Set Up JDK
23+ uses : actions/setup-java@v3
24+ with :
25+ distribution : ' temurin'
26+ java-version : ' 17'
27+ cache : ' gradle'
28+
29+ - name : Publish Snapshots
30+ env :
31+ GPG_PASSPHRASE : ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
32+ SONATYPE_USERNAME : ${{ secrets.SONATYPE_USERNAME }}
33+ SONATYPE_PASSWORD : ${{ secrets.SONATYPE_PASSWORD }}
34+ run : ./gradlew publishSnapshots
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ plugins {
88 id ' org.jetbrains.kotlinx.kover' version " 0.9.1" apply false
99}
1010
11+ apply from : " $rootDir /gradle-tasks/publish-snapshot.gradle"
12+
1113subprojects {
1214 /* Shared plugins between all modules */
1315 apply plugin : ' java'
Original file line number Diff line number Diff line change @@ -3,9 +3,10 @@ import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
33
44plugins {
55 id ' maven-publish'
6+ id ' signing'
67}
78
8- apply from : " $rootDir /gradle-tasks/publishing .gradle"
9+ apply from : " $rootDir /gradle-tasks/publish .gradle"
910
1011dependencies {
1112 /* Kotlin */
@@ -48,7 +49,7 @@ kover {
4849 filters {
4950 excludes {
5051 packages(
51- " com.expediagroup.sdk.core.exception"
52+ " com.expediagroup.sdk.core.exception"
5253 )
5354 }
5455 }
Original file line number Diff line number Diff line change @@ -4,9 +4,10 @@ import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
44plugins {
55 id ' com.apollographql.apollo' version ' 4.1.1'
66 id ' maven-publish'
7+ id ' signing'
78}
89
9- apply from : " $rootDir /gradle-tasks/publishing .gradle"
10+ apply from : " $rootDir /gradle-tasks/publish .gradle"
1011
1112dependencies {
1213 /* Kotlin */
@@ -52,10 +53,10 @@ kover {
5253 filters {
5354 excludes {
5455 packages(
55- " testservice" ,
56- " com.expediagroup.sdk.graphql.model" ,
57- " com.expediagroup.sdk.graphql.exception" ,
58- " com.expediagroup.sdk.graphql.paging.model" ,
56+ " testservice" ,
57+ " com.expediagroup.sdk.graphql.model" ,
58+ " com.expediagroup.sdk.graphql.exception" ,
59+ " com.expediagroup.sdk.graphql.paging.model" ,
5960 )
6061 }
6162 }
Original file line number Diff line number Diff line change @@ -3,13 +3,10 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
33plugins {
44 id ' java-gradle-plugin'
55 id ' maven-publish'
6+ id ' signing'
67}
78
8- apply from : " $rootDir /gradle-tasks/publishing.gradle"
9-
10- repositories {
11- mavenCentral()
12- }
9+ apply from : " $rootDir /gradle-tasks/publish.gradle"
1310
1411dependencies {
1512 implementation ' org.openapitools:openapi-generator:7.11.0'
Original file line number Diff line number Diff line change @@ -3,13 +3,10 @@ import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
33
44plugins {
55 id ' maven-publish'
6+ id ' signing'
67}
78
8- apply from : " $rootDir /gradle-tasks/publishing.gradle"
9-
10- repositories {
11- mavenCentral()
12- }
9+ apply from : " $rootDir /gradle-tasks/publish.gradle"
1310
1411dependencies {
1512 /* Kotlin */
Original file line number Diff line number Diff line change @@ -3,9 +3,10 @@ import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
33
44plugins {
55 id ' maven-publish'
6+ id ' signing'
67}
78
8- apply from : " $rootDir /gradle-tasks/publishing .gradle"
9+ apply from : " $rootDir /gradle-tasks/publish .gradle"
910
1011dependencies {
1112 /* Kotlin */
Original file line number Diff line number Diff line change 1+ tasks. register(" publishSnapshots" ) {
2+ def snapshotModules = rootProject. subprojects. findAll { project ->
3+ project. version. toString(). contains(" -SNAPSHOT" ) && project. tasks. named(" publish" ) != null
4+ }
5+
6+ if (! snapshotModules. isEmpty()) {
7+ dependsOn snapshotModules. collect { " :${ it.name} :publish -Psigning.gnupg.passphrase=${ System.getenv('GPG_PASSPHRASE')} " }
8+ }
9+
10+ doLast {
11+ if (snapshotModules. isEmpty()) {
12+ println " ❌ No snapshot modules to publish."
13+ } else {
14+ println " 📦 Successfully published snapshots for: ${ snapshotModules*.name} "
15+ }
16+ }
17+ }
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ publishing {
44 from components. java
55 artifactId = project. property(" ARTIFACT_NAME" )
66 groupId = project. property(" GROUP_ID" )
7- version = project. property(" VERSION" )
7+ version = project. findProperty( " SNAPSHOT_VERSION " ) ? project . findProperty( " SNAPSHOT_VERSION " ) : project . property(" VERSION" )
88 description = findProperty(" DESCRIPTION" )
99
1010 pom {
@@ -39,8 +39,23 @@ publishing {
3939 }
4040
4141 repositories {
42- // TODO: Add release and snapshot repos
43-
44- mavenLocal()
42+ maven {
43+ if (project. version. contains(" SNAPSHOT" )) {
44+ name = " oss-sonatype-snapshots"
45+ url = uri(" https://oss.sonatype.org/content/repositories/snapshots" )
46+ } else {
47+ name = " oss-sonatype-releases"
48+ url = uri(" https://oss.sonatype.org/service/local/staging/deploy/maven2" )
49+ }
50+ credentials {
51+ username = System . getenv(" SONATYPE_USERNAME" )
52+ password = System . getenv(" SONATYPE_PASSWORD" )
53+ }
54+ }
4555 }
4656}
57+
58+ signing {
59+ useGpgCmd() // Ensure Gradle uses GPG for signing
60+ sign publishing. publications
61+ }
You can’t perform that action at this time.
0 commit comments