mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 06:14:53 +08:00
[libgdx][android] Fix release publishing to Central Portal
This commit is contained in:
parent
1d311d9135
commit
3aa7d29086
@ -14,6 +14,7 @@ plugins {
|
|||||||
alias(libs.plugins.androidApplication) apply false
|
alias(libs.plugins.androidApplication) apply false
|
||||||
alias(libs.plugins.jetbrainsKotlinAndroid) apply false
|
alias(libs.plugins.jetbrainsKotlinAndroid) apply false
|
||||||
alias(libs.plugins.androidLibrary) apply false
|
alias(libs.plugins.androidLibrary) apply false
|
||||||
|
id("org.jreleaser") version "1.17.0" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read version from spine-libgdx gradle.properties to ensure consistency
|
// Read version from spine-libgdx gradle.properties to ensure consistency
|
||||||
@ -31,7 +32,24 @@ fun getSpineVersion(): String {
|
|||||||
throw GradleException("version property not found in spine-libgdx gradle.properties")
|
throw GradleException("version property not found in spine-libgdx gradle.properties")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Placeholder functions - you need to implement these correctly!
|
||||||
|
fun getRepositoryUsername(): String {
|
||||||
|
// Example: return project.findProperty("mavenCentralUsername") as? String ?: System.getenv("MAVEN_CENTRAL_USERNAME") ?: ""
|
||||||
|
return project.findProperty("sonatypeUsername") as? String ?: System.getenv("SONATYPE_USERNAME") ?: throw GradleException("Sonatype username not set")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getRepositoryPassword(): String {
|
||||||
|
// Example: return project.findProperty("mavenCentralPassword") as? String ?: System.getenv("MAVEN_CENTRAL_PASSWORD") ?: ""
|
||||||
|
return project.findProperty("sonatypePassword") as? String ?: System.getenv("SONATYPE_PASSWORD") ?: throw GradleException("Sonatype password not set")
|
||||||
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "com.esotericsoftware.spine"
|
group = "com.esotericsoftware.spine"
|
||||||
version = getSpineVersion()
|
version = getSpineVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add a clean task for JReleaser
|
||||||
|
tasks.register("clean") {
|
||||||
|
description = "Clean root project"
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,8 +26,9 @@ VERSION=$(grep '^version=' ../spine-libgdx/gradle.properties | cut -d'=' -f2)
|
|||||||
|
|
||||||
if echo "$VERSION" | grep -q "SNAPSHOT"; then
|
if echo "$VERSION" | grep -q "SNAPSHOT"; then
|
||||||
echo "Publishing SNAPSHOT version $VERSION to Central Portal..."
|
echo "Publishing SNAPSHOT version $VERSION to Central Portal..."
|
||||||
./gradlew publishReleasePublicationToSonaTypeRepository --info
|
./gradlew :spine-android:publishReleasePublicationToSonaTypeRepository --info
|
||||||
else
|
else
|
||||||
echo "Publishing RELEASE version $VERSION to Central Portal via JReleaser..."
|
echo "Publishing RELEASE version $VERSION to Central Portal via JReleaser..."
|
||||||
./gradlew publishRelease -PRELEASE --info
|
./gradlew :spine-android:publishReleasePublicationToSonaTypeRepository -PRELEASE
|
||||||
|
./gradlew :spine-android:jreleaserDeploy -PRELEASE --info
|
||||||
fi
|
fi
|
||||||
@ -21,10 +21,6 @@ fun readSpineLibgdxProperty(propertyName: String): String {
|
|||||||
throw GradleException("Property '$propertyName' not found in spine-libgdx gradle.properties")
|
throw GradleException("Property '$propertyName' not found in spine-libgdx gradle.properties")
|
||||||
}
|
}
|
||||||
|
|
||||||
// JReleaser config for release builds to Central Portal
|
|
||||||
if (project.hasProperty("RELEASE")) {
|
|
||||||
apply(plugin = "org.jreleaser")
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "com.esotericsoftware.spine"
|
namespace = "com.esotericsoftware.spine"
|
||||||
@ -176,14 +172,31 @@ afterEvaluate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For release builds, create a task that depends on publishing and finalizes with jreleaser
|
// JReleaser config for release builds to Central Portal
|
||||||
if (project.hasProperty("RELEASE")) {
|
if (project.hasProperty("RELEASE")) {
|
||||||
tasks.register("publishRelease") {
|
apply(plugin = "org.jreleaser")
|
||||||
dependsOn(tasks.withType<PublishToMavenRepository>())
|
|
||||||
doLast {
|
configure<org.jreleaser.gradle.plugin.JReleaserExtension> {
|
||||||
exec {
|
deploy {
|
||||||
commandLine("./gradlew", "jreleaserDeploy")
|
maven {
|
||||||
|
mavenCentral {
|
||||||
|
create("sonatype") {
|
||||||
|
setActive("ALWAYS")
|
||||||
|
url = "https://central.sonatype.com/api/v1/publisher"
|
||||||
|
username = if (hasProperty("MAVEN_USERNAME")) property("MAVEN_USERNAME").toString() else ""
|
||||||
|
password = if (hasProperty("MAVEN_PASSWORD")) property("MAVEN_PASSWORD").toString() else ""
|
||||||
|
stagingRepository(layout.buildDirectory.dir("staging-deploy").get().asFile.absolutePath)
|
||||||
|
sign = false
|
||||||
|
verifyPom = false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.register("publishRelease") {
|
||||||
|
dependsOn(tasks.withType<PublishToMavenRepository>())
|
||||||
|
finalizedBy(tasks.named("jreleaserDeploy"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
group=com.esotericsoftware.spine
|
group=com.esotericsoftware.spine
|
||||||
version=4.2.10-SNAPSHOT
|
version=4.2.10
|
||||||
libgdx_version=1.13.5
|
libgdx_version=1.13.5
|
||||||
POM_NAME=spine-libgdx
|
POM_NAME=spine-libgdx
|
||||||
POM_DESCRIPTION=Spine Runtime for libGDX
|
POM_DESCRIPTION=Spine Runtime for libGDX
|
||||||
|
|||||||
@ -29,5 +29,6 @@ if echo "$VERSION" | grep -q "SNAPSHOT"; then
|
|||||||
./gradlew publishReleasePublicationToSonaTypeRepository
|
./gradlew publishReleasePublicationToSonaTypeRepository
|
||||||
else
|
else
|
||||||
echo "Publishing RELEASE version $VERSION to Central Portal via JReleaser..."
|
echo "Publishing RELEASE version $VERSION to Central Portal via JReleaser..."
|
||||||
./gradlew publishRelease -PRELEASE
|
./gradlew publishReleasePublicationToSonaTypeRepository -PRELEASE
|
||||||
|
./gradlew jreleaserDeploy -PRELEASE
|
||||||
fi
|
fi
|
||||||
@ -92,8 +92,8 @@ project("spine-libgdx") {
|
|||||||
name = "SonaType"
|
name = "SonaType"
|
||||||
url = project.version.endsWith("-SNAPSHOT")
|
url = project.version.endsWith("-SNAPSHOT")
|
||||||
? getSnapshotRepositoryUrl()
|
? getSnapshotRepositoryUrl()
|
||||||
// If release build, dump artifacts to local build/staging-deploy folder for consumption by jreleaser
|
// If release build, dump artifacts to root project build/staging-deploy folder for consumption by jreleaser
|
||||||
: layout.buildDirectory.dir('staging-deploy')
|
: rootProject.layout.buildDirectory.dir('staging-deploy')
|
||||||
|
|
||||||
if (project.version.endsWith("-SNAPSHOT") && (getRepositoryUsername() || getRepositoryPassword())) {
|
if (project.version.endsWith("-SNAPSHOT") && (getRepositoryUsername() || getRepositoryPassword())) {
|
||||||
credentials {
|
credentials {
|
||||||
@ -119,8 +119,29 @@ project("spine-libgdx") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For release builds, create a task that depends on publishing and finalizes with jreleaser
|
// JReleaser config for release builds to Central Portal
|
||||||
if (project.hasProperty('RELEASE')) {
|
if (project.hasProperty('RELEASE')) {
|
||||||
|
apply plugin: 'org.jreleaser'
|
||||||
|
|
||||||
|
jreleaser {
|
||||||
|
deploy {
|
||||||
|
maven {
|
||||||
|
mavenCentral {
|
||||||
|
sonatype {
|
||||||
|
active = 'ALWAYS'
|
||||||
|
username = getRepositoryUsername()
|
||||||
|
password = getRepositoryPassword()
|
||||||
|
url = 'https://central.sonatype.com/api/v1/publisher'
|
||||||
|
stagingRepository("${rootProject.buildDir}/staging-deploy")
|
||||||
|
sign = false
|
||||||
|
verifyPom = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// For release builds, create a task that depends on publishing and finalizes with jreleaser
|
||||||
tasks.register('publishRelease') {
|
tasks.register('publishRelease') {
|
||||||
dependsOn tasks.withType(PublishToMavenRepository)
|
dependsOn tasks.withType(PublishToMavenRepository)
|
||||||
finalizedBy tasks.named('jreleaserDeploy')
|
finalizedBy tasks.named('jreleaserDeploy')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user