Skip to content

Commit 6a6494d

Browse files
fix: cleanups
1 parent d5f3d43 commit 6a6494d

File tree

6 files changed

+63
-25
lines changed

6 files changed

+63
-25
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish Snapshots
2+
3+
on:
4+
push:
5+
branches:
6+
- "mdwairi/oauth-support"
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+
28+
- name: Publish Snapshots
29+
env:
30+
GPG_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
31+
GPG_SECRET: ${{ secrets.GPG_PRIVATE_KEY }}
32+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
33+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
34+
run: ./gradlew publishSnapshots

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ plugins {
1313
group = project.property("GROUP_ID") as String
1414

1515
apply("gradle-tasks/specs.gradle.kts")
16+
apply("$rootDir/gradle-tasks/snapshot.gradle")
1617

1718
allprojects {
1819
repositories {

gradle-tasks/snapshot.gradle

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Nexus publishing plugin relies on the root project version to determine which repository to use (releases | snapshots)
2+
// We're setting the root project to a dummy version (1.0.0-SNAPSHOT) to instruct the plugin to use the snapshot repo.
3+
// This version won't be published. The publishSnapshots task will publish submodules with the defined version in their gradle.properties
4+
gradle.taskGraph.whenReady { taskGraph ->
5+
if (taskGraph.hasTask(":publishSnapshots")) {
6+
rootProject.version = "1.0.0-SNAPSHOT"
7+
println "📌 Setting root project version to 1.0.0-SNAPSHOT for publishSnapshots task"
8+
}
9+
}
10+
11+
tasks.register("publishSnapshots") {
12+
def snapshotModules = rootProject.subprojects.findAll { project ->
13+
project.version.toString().contains("-SNAPSHOT") && project.tasks.named("publish") != null
14+
}
15+
16+
if (!snapshotModules.isEmpty()) {
17+
dependsOn snapshotModules.collect { ":${it.name}:publish" }
18+
}
19+
20+
doLast {
21+
if (snapshotModules.isEmpty()) {
22+
println "❌ No snapshot modules to publish."
23+
} else {
24+
println "📦 Successfully published snapshots for: ${snapshotModules*.name}"
25+
}
26+
}
27+
}

gradle-tasks/snapshot.gradle.kts

Lines changed: 0 additions & 23 deletions
This file was deleted.

xap-sdk/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ dependencies {
1313

1414
apply("$rootDir/gradle-tasks/publish.gradle.kts")
1515
apply("$rootDir/gradle-tasks/signing.gradle.kts")
16-
apply("$rootDir/gradle-tasks/snapshot.gradle.kts")
1716
apply("$rootDir/gradle-tasks/sdk-properties.gradle.kts")

xap-sdk/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
ARTIFACT_NAME=xap-sdk
22
DESCRIPTION=The Expedia API Platform (XAP) SDK
33

4-
VERSION=2.0.0-beta
4+
VERSION=2.0.0-SNAPSHOT

0 commit comments

Comments
 (0)