Skip to content

Commit 5f0eaad

Browse files
committed
Add support for spring-io/central-publish-action
* Rework `spring-artifactory-deploy-to-maven-central.yml` to conditionally call `spring-io/nexus-sync-action` or `spring-io/central-publish-action` depending on the provided Maven Central secrets * Remove redundant local `actions\spring-publish-maven-central-portal` in favor of public `spring-io/central-publish-action` * Add Central Portal secrets expectations into `spring-artifactory-gradle-release.yml` and `spring-artifactory-maven-release.yml`
1 parent c52c30e commit 5f0eaad

File tree

5 files changed

+30
-117
lines changed

5 files changed

+30
-117
lines changed

.github/actions/spring-publish-maven-central-portal/action.yml

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

.github/workflows/spring-artifactory-deploy-to-maven-central.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ on:
1111
description: 'The Artifactory Build Number'
1212
required: true
1313
type: string
14-
releaseVersion:
15-
description: 'The release version'
16-
required: true
17-
type: string
1814
runner:
1915
description: 'The runner for job'
2016
required: false
@@ -28,23 +24,33 @@ on:
2824
required: false
2925
OSSRH_STAGING_PROFILE_NAME:
3026
required: false
31-
PORTAL_TOKEN_USERNAME:
27+
CENTRAL_TOKEN_USERNAME:
3228
required: false
33-
PORTAL_TOKEN_PASSWORD:
29+
CENTRAL_TOKEN_PASSWORD:
3430
required: false
3531
JF_ARTIFACTORY_SPRING:
3632
required: true
3733

3834
env:
3935
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
4036
OSSRH_S01_TOKEN_USERNAME: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
37+
CENTRAL_TOKEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
4138
WORKFLOWS_REF: main
4239

4340
jobs:
4441
deploy-to-maven-central:
4542
runs-on: ${{ inputs.runner }}
4643
steps:
4744

45+
- name: Verify Maven Secrets
46+
run: |
47+
if [ -z $OSSRH_S01_TOKEN_USERNAME ] || [ -z $CENTRAL_TOKEN_USERNAME ]
48+
then
49+
gh run cancel ${{ github.run_id }}
50+
echo "::error title=Cannot deploy to Maven Central:: The 'OSSRH_S01_TOKEN_USERNAME' & 'OSSRH_S01_TOKEN_PASSWORD' or 'CENTRAL_TOKEN_USERNAME' & 'CENTRAL_TOKEN_PASSWORD' pair of secrets must be provided"
51+
exit 1
52+
fi
53+
4854
- uses: actions/checkout@v4
4955
with:
5056
repository: spring-io/spring-github-workflows
@@ -60,8 +66,8 @@ jobs:
6066
--spec utils/release-files-spec.json \
6167
--spec-vars "buildname=${{ inputs.buildName }};buildnumber=${{ inputs.buildNumber }}"
6268
63-
jarToCheck=$(find nexus -name "*.jar" -print -quit)
64-
jarToCheck=${jarToCheck#nexus}
69+
jarToCheck=$(find central_bundle -name "*.jar" -print -quit)
70+
jarToCheck=${jarToCheck#central_bundle}
6571
echo jarToCheck=$jarToCheck >> $GITHUB_OUTPUT
6672
6773
- uses: spring-io/[email protected]
@@ -88,10 +94,9 @@ jobs:
8894
url: https://repo.maven.apache.org/maven2${{ steps.download-release-files.outputs.jarToCheck }}
8995

9096
- name: Deploy Bundle to Maven Central Portal
91-
if: env.PORTAL_TOKEN_USERNAME
92-
uses: ./.github/actions/spring-publish-maven-central-portal
97+
if: env.CENTRAL_TOKEN_USERNAME
98+
uses: spring-io/central-[email protected]
9399
with:
94-
release-version: ${{ inputs.releaseVersion }}
95-
token-username: ${{ secrets.PORTAL_TOKEN_USERNAME }}
96-
token-password: ${{ secrets.PORTAL_TOKEN_PASSWORD }}
97-
deployment-status-interval: '1m'
100+
token-name: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
101+
token: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
102+
dir: central_bundle

.github/workflows/spring-artifactory-gradle-release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ on:
6363
required: false
6464
OSSRH_STAGING_PROFILE_NAME:
6565
required: false
66+
CENTRAL_TOKEN_USERNAME:
67+
required: false
68+
CENTRAL_TOKEN_PASSWORD:
69+
required: false
6670
GPG_PASSPHRASE:
6771
required: false
6872
GPG_PRIVATE_KEY:
@@ -136,7 +140,6 @@ jobs:
136140
with:
137141
buildName: ${{ needs.staging.outputs.buildName }}
138142
buildNumber: ${{ needs.staging.outputs.buildNumber }}
139-
releaseVersion: ${{ needs.releaseVersion.outputs.releaseVersion }}
140143
runner: ${{ inputs.runner }}
141144
secrets: inherit
142145

.github/workflows/spring-artifactory-maven-release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ on:
6464
required: false
6565
OSSRH_STAGING_PROFILE_NAME:
6666
required: false
67+
CENTRAL_TOKEN_USERNAME:
68+
required: false
69+
CENTRAL_TOKEN_PASSWORD:
70+
required: false
6771
GPG_PASSPHRASE:
6872
required: false
6973
GPG_PRIVATE_KEY:
@@ -136,7 +140,6 @@ jobs:
136140
with:
137141
buildName: ${{ needs.staging.outputs.buildName }}
138142
buildNumber: ${{ needs.staging.outputs.buildNumber }}
139-
releaseVersion: ${{ needs.releaseVersion.outputs.releaseVersion }}
140143
runner: ${{ inputs.runner }}
141144
secrets: inherit
142145

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ SPRING_RELEASE_CHAT_WEBHOOK_URL
1616
OSSRH_S01_TOKEN_USERNAME
1717
OSSRH_S01_TOKEN_PASSWORD
1818
OSSRH_STAGING_PROFILE_NAME
19+
CENTRAL_TOKEN_USERNAME
20+
CENTRAL_TOKEN_PASSWORD
1921
GPG_PASSPHRASE
2022
GPG_PRIVATE_KEY
2123
```
@@ -75,7 +77,7 @@ The logic of this release workflow:
7577
- Call Maven or Gradle (according to the workflow choice for the project in the repository) with the release version extracted from the previous job.
7678
This job stages released artifacts using JFrog Artifactory plugin into `libs-staging-local` repository on Spring Artifactory and commits `Next development version` to the branch we are releasing against
7779
- The next job is to [verify staged artifacts](#verify-staged-artifacts)
78-
- When verification is successful, next job promotes release from staging either to `libs-milestone-local` or `libs-release-local` (by default) (and optional to Maven Central: if `OSSRH_STAGING_PROFILE_NAME` secret is provided) according to the releasing version schema
80+
- When verification is successful, next job promotes release from staging either to `libs-milestone-local` or `libs-release-local` (by default) (and optional to Maven Central: if `bundleName` input is not provided) according to the releasing version schema
7981
- Then [spring-finalize-release.yml](.github/workflows/spring-finalize-release.yml) job is executed, which tags release into GitHub, commits next development version, generates release notes using [Spring Changelog Generator](https://github.com/spring-io/github-changelog-generator) excluding repository admins from `Contributors` section.
8082
The `gh release create` command is performed on a tag for just released version.
8183
Then spring.io project page is updated for newly released version.

0 commit comments

Comments
 (0)