Skip to content

Commit

Permalink
setup a generic deploy task
Browse files Browse the repository at this point in the history
  • Loading branch information
pschichtel committed Jul 3, 2024
1 parent 5eff708 commit aa9aa7c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build
run: ./gradlew --no-configuration-cache --no-parallel publish "-PsonatypeUsername=$SONATYPE_USERNAME" "-PsonatypePassword=$SONATYPE_PASSWORD"
run: ./gradlew --no-configuration-cache --no-parallel mavenCentralDeploy "-PsonatypeUsername=$SONATYPE_USERNAME" "-PsonatypePassword=$SONATYPE_PASSWORD"
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
13 changes: 13 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,16 @@ val testAll by tasks.registering(DefaultTask::class) {
this@registering.dependsOn(it)
}
}

val mavenCentralDeploy by tasks.registering(DefaultTask::class) {
group = "publishing"
val isSnapshot = project.version.toString().endsWith("-SNAPSHOT")

val publishTasks = subprojects
.flatMap { it.tasks.withType<PublishToMavenRepository>() }
.filter { it.repository.name == "sonatype" }
dependsOn(publishTasks)
if (!isSnapshot) {
dependsOn(tasks.closeAndReleaseStagingRepositories)
}
}

0 comments on commit aa9aa7c

Please sign in to comment.