diff --git a/README.md b/README.md index 728f53b..434c22a 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ repositories { } dependencies { - implementation("com.lopcode.vips-ffm:vips-ffm-core:1.11.0") + implementation("com.lopcode.vips-ffm:vips-ffm-core:1.11.1") } ``` diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 859f9b3..200c963 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -123,6 +123,7 @@ dependencies {} val githubVersion = System.getenv("GITHUB_VERSION") ?: null val mavenVersion = githubVersion?.removePrefix("v") ?: "local" val releasePath = "repos/release-${githubVersion}" +val relocationReleasePath = "repos/relocation-${githubVersion}" val coreGroupId = "com.lopcode.vips-ffm" val coreArtifactId = "vips-ffm-core" @@ -198,6 +199,11 @@ publishing { name = "Local" url = uri(layout.buildDirectory.dir(releasePath)) } + // Maven Central rejects a deployment containing more than one namespace + maven { + name = "LocalRelocation" + url = uri(layout.buildDirectory.dir(relocationReleasePath)) + } } } @@ -216,13 +222,13 @@ if (!signingKey.isNullOrBlank()) { } tasks.withType().configureEach { - onlyIf("relocation POMs are only published to Maven Central") { - publication.name != "relocation" || repository.name == "Local" + onlyIf("relocation POMs are only published to their own Maven Central bundle") { + (publication.name == "relocation") == (repository.name == "LocalRelocation") } } tasks.register("packageMavenCentralRelease") { - dependsOn("publishMavenJavaPublicationToLocalRepository", "publishRelocationPublicationToLocalRepository") + dependsOn("publishMavenJavaPublicationToLocalRepository") archiveFileName.set("release-${githubVersion}.zip") destinationDirectory.set(layout.buildDirectory.dir("repos")) @@ -231,4 +237,16 @@ tasks.register("packageMavenCentralRelease") { exclude("*/.*") from(layout.buildDirectory.dir(releasePath)) +} + +tasks.register("packageMavenCentralRelocation") { + dependsOn("publishRelocationPublicationToLocalRelocationRepository") + + archiveFileName.set("relocation-${githubVersion}.zip") + destinationDirectory.set(layout.buildDirectory.dir("repos")) + + // exclude hidden files + exclude("*/.*") + + from(layout.buildDirectory.dir(relocationReleasePath)) } \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 3ae30b7..98f1e4b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -70,7 +70,7 @@

Usage

} dependencies { - implementation("com.lopcode.vips-ffm:vips-ffm-core:1.11.0") + implementation("com.lopcode.vips-ffm:vips-ffm-core:1.11.1") }

Please note that the package has relocated from app.photofox.vips-ffm to com.lopcode.vips-ffm. New versions will diff --git a/publish_release_to_maven_central.sh b/publish_release_to_maven_central.sh index 9e4fc21..d6dabba 100755 --- a/publish_release_to_maven_central.sh +++ b/publish_release_to_maven_central.sh @@ -15,14 +15,22 @@ git describe --exact-match --tags SIGNING_KEY_ID=$(op read "op://Private/Sonatype GPG/key id") \ SIGNING_KEY_PASSPHRASE=$(op read "op://Private/Sonatype GPG/password") \ -./gradlew clean core:compileJava core:packageMavenCentralRelease +./gradlew clean core:compileJava core:packageMavenCentralRelease core:packageMavenCentralRelocation MAVEN_CENTRAL_USER=$(op read "op://Private/New Maven Central Portal Publish/username") MAVEN_CENTRAL_TOKEN=$(op read "op://Private/New Maven Central Portal Publish/password") BEARER_TOKEN=$(echo "$MAVEN_CENTRAL_USER:$MAVEN_CENTRAL_TOKEN" | base64) -curl --request POST \ - --verbose \ - --header "Authorization: Bearer $BEARER_TOKEN" \ - --form bundle=@core/build/repos/release-"$GITHUB_VERSION".zip \ - https://central.sonatype.com/api/v1/publisher/upload?name="$GITHUB_VERSION"\&publishingType=USER_MANAGED \ No newline at end of file +# Maven Central accepts one namespace per deployment, so each bundle is uploaded separately +upload_bundle() { + echo "Uploading $1 as deployment \"$2\"..." + curl --request POST \ + --fail-with-body \ + --header "Authorization: Bearer $BEARER_TOKEN" \ + --form bundle=@"$1" \ + https://central.sonatype.com/api/v1/publisher/upload?name="$2"\&publishingType=USER_MANAGED + echo +} + +upload_bundle core/build/repos/release-"$GITHUB_VERSION".zip "$GITHUB_VERSION" +upload_bundle core/build/repos/relocation-"$GITHUB_VERSION".zip "$GITHUB_VERSION-relocation" \ No newline at end of file