[CI] Update release to close and release Sonatype repo separately
This commit is contained in:
26
.github/workflows/central-release.yml
vendored
Normal file
26
.github/workflows/central-release.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: Maven Central (Release Sonatype)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
GRADLE_ENTERPRISE_CACHE_USER: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
|
||||
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
|
||||
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
|
||||
|
||||
jobs:
|
||||
release_sonatype_repo:
|
||||
if: github.repository == 'spring-projects/spring-pulsar'
|
||||
name: Release Sonatype Staging Repo
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: spring-io/spring-gradle-build-action@v2
|
||||
- name: Release Sonatype repo to Maven Central
|
||||
env:
|
||||
OSSRH_TOKEN_USERNAME: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
|
||||
OSSRH_TOKEN_PASSWORD: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
|
||||
run: |
|
||||
./gradlew findSonatypeStagingRepository releaseSonatypeStagingRepository \
|
||||
--stacktrace \
|
||||
-PossrhUsername="$OSSRH_TOKEN_USERNAME" -PossrhPassword="$OSSRH_TOKEN_PASSWORD"
|
||||
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -119,7 +119,7 @@ jobs:
|
||||
OSSRH_TOKEN_USERNAME: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
|
||||
OSSRH_TOKEN_PASSWORD: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
|
||||
run: |
|
||||
./gradlew publishArtifacts finalizeDeployArtifacts \
|
||||
./gradlew publishArtifacts \
|
||||
--stacktrace \
|
||||
-PossrhUsername="$OSSRH_TOKEN_USERNAME" -PossrhPassword="$OSSRH_TOKEN_PASSWORD" \
|
||||
-PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD"
|
||||
@@ -153,7 +153,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
timeout-minutes: 90
|
||||
timeout-minutes: 120
|
||||
if: ${{ !endsWith(needs.prerequisites.outputs.project_version, '-SNAPSHOT') }}
|
||||
env:
|
||||
REPO: ${{ github.repository }}
|
||||
|
||||
@@ -44,7 +44,7 @@ dependencies {
|
||||
implementation localGroovy()
|
||||
implementation 'commons-codec:commons-codec:1.15'
|
||||
implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.4'
|
||||
implementation 'io.github.gradle-nexus:publish-plugin:1.1.0'
|
||||
implementation 'io.github.gradle-nexus:publish-plugin:1.3.0'
|
||||
implementation("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.38")
|
||||
implementation 'io.spring.nohttp:nohttp-gradle:0.0.11'
|
||||
implementation "org.apache.maven:maven-embedder:3.6.3"
|
||||
|
||||
@@ -39,13 +39,7 @@ public class RootProjectPlugin implements Plugin<Project> {
|
||||
pluginManager.apply(SpringNexusPublishPlugin.class);
|
||||
pluginManager.apply(ArtifactoryPlugin.class);
|
||||
pluginManager.apply(SonarQubeConventionsPlugin.class);
|
||||
|
||||
project.getRepositories().mavenCentral();
|
||||
|
||||
Task finalizeDeployArtifacts = project.task("finalizeDeployArtifacts");
|
||||
if (ProjectUtils.isRelease(project) && project.hasProperty("ossrhUsername")) {
|
||||
finalizeDeployArtifacts.dependsOn(project.getTasks().findByName("closeAndReleaseOssrhStagingRepository"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class PublishArtifactsPlugin implements Plugin<Project> {
|
||||
publishArtifacts.setGroup("Publishing");
|
||||
publishArtifacts.setDescription("Publish the artifacts to either Artifactory or Maven Central based on the version");
|
||||
if (ProjectUtils.isRelease(project)) {
|
||||
publishArtifacts.dependsOn("publishToOssrh");
|
||||
publishArtifacts.dependsOn("publishToOssrh", "closeOssrhStagingRepository");
|
||||
}
|
||||
else {
|
||||
publishArtifacts.dependsOn("artifactoryPublish");
|
||||
|
||||
Reference in New Issue
Block a user