Skip to content

Commit 3aeec18

Browse files
committed
[RelEng] Migrate Maven publication to new Central Portal API
1 parent a2a5ba7 commit 3aeec18

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

JenkinsJobs/Releng/publishToMaven.jenkinsfile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ pipeline {
9393
stage('Publish project to Maven'){
9494
environment {
9595
SETTINGS = "/home/jenkins/.m2/settings-deploy-ossrh-${PROJECT == 'platform' ? 'releng': PROJECT}.xml"
96+
SONATYPE_BEARER_TOKEN = credentials("central-sonatype-bearer-tokenname-${PROJECT}")
9697
// The location of the temporarily file that contains the secret file content
9798
// (see https://www.jenkins.io/doc/book/pipeline/syntax/#supported-credentials-type):
9899
KEYRING = credentials("secret-subkeys-${PROJECT == 'platform' ? 'releng': PROJECT}.asc")
@@ -117,7 +118,7 @@ pipeline {
117118
echo "The released version of file "${pomFile}" is already present at $MAVEN_CENTRAL_URL."
118119
fi
119120
else
120-
URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/
121+
URL=file://$(pwd)
121122
REPO_ID=ossrh # server-id in the settings.xml, used for authentication
122123
MAVEN_CENTRAL_URL=https://repo1.maven.org/maven2/${pomFolder}
123124
echo "Checking ${MAVEN_CENTRAL_URL}"
@@ -157,6 +158,20 @@ pipeline {
157158
-DpomFile=${pomFile} -Dfile=${file} \\
158159
${SOURCES_ARG} ${JAVADOC_ARG}
159160
done
161+
if [ "${snapshotOrRelease}" == 'release' ]; then
162+
zipFileName="${PROJECT}-artifacts.zip"
163+
zipFileContent="org/eclipse/${PROJECT}"
164+
165+
echo "Zip file ${zipFileName} with from '${zipFileContent}'"
166+
zip -r "${zipFileName}" "${zipFileContent}"
167+
168+
set -x
169+
curl --request POST \
170+
--verbose \
171+
--header "Authorization: Bearer ${SONATYPE_BEARER_TOKEN}" \
172+
--form "bundle=@${zipFileName}" \
173+
'https://central.sonatype.com/api/v1/publisher/upload'
174+
fi
160175
'''
161176
}
162177
}

0 commit comments

Comments
 (0)