Commit 0b64ac07 authored by Madhura Bhave's avatar Madhura Bhave

Add a separate job for syncing release to central

See gh-12292
parent 6d9692ff
...@@ -345,6 +345,19 @@ jobs: ...@@ -345,6 +345,19 @@ jobs:
ARTIFACTORY_SERVER: ((artifactory-server)) ARTIFACTORY_SERVER: ((artifactory-server))
ARTIFACTORY_USERNAME: ((artifactory-username)) ARTIFACTORY_USERNAME: ((artifactory-username))
ARTIFACTORY_PASSWORD: ((artifactory-password)) ARTIFACTORY_PASSWORD: ((artifactory-password))
- name: sync-to-maven-central
serial: true
plan:
- get: spring-boot-ci-image
- get: git-repo
trigger: false
- get: artifactory-repo
trigger: false
passed: [promote-release]
- task: sync-to-maven-central
image: spring-boot-ci-image
file: git-repo/ci/tasks/sync-to-maven-central.yml
params:
BINTRAY_USERNAME: ((bintray-username)) BINTRAY_USERNAME: ((bintray-username))
BINTRAY_PASSWORD: ((bintray-password)) BINTRAY_PASSWORD: ((bintray-password))
SONATYPE_USERNAME: ((sonatype-username)) SONATYPE_USERNAME: ((sonatype-username))
...@@ -355,7 +368,7 @@ groups: ...@@ -355,7 +368,7 @@ groups:
- name: "Build" - name: "Build"
jobs: ["build", "jdk9-build", "jdk10-build"] jobs: ["build", "jdk9-build", "jdk10-build"]
- name: "Release" - name: "Release"
jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release"] jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "sync-to-maven-central"]
- name: "CI Images" - name: "CI Images"
jobs: ["build-spring-boot-ci-images"] jobs: ["build-spring-boot-ci-images"]
- name: "Build Pull Requests" - name: "Build Pull Requests"
......
...@@ -43,16 +43,6 @@ if [[ $RELEASE_TYPE = "RELEASE" ]]; then ...@@ -43,16 +43,6 @@ if [[ $RELEASE_TYPE = "RELEASE" ]]; then
-f \ -f \
-X \ -X \
POST "${ARTIFACTORY_SERVER}/api/build/distribute/${buildName}/${buildNumber}" > /dev/null || { echo "Failed to publish" >&2; exit 1; } POST "${ARTIFACTORY_SERVER}/api/build/distribute/${buildName}/${buildNumber}" > /dev/null || { echo "Failed to publish" >&2; exit 1; }
curl \
-s \
--connect-timeout 240 \
--max-time 2700 \
-u ${BINTRAY_USERNAME}:${BINTRAY_PASSWORD} \
-H "Content-Type: application/json" -d "{\"username\": \"${SONATYPE_USERNAME}\", \"password\": \"${SONATYPE_PASSWORD}\"}" \
-f \
-X \
POST "https://api.bintray.com/maven_central_sync/${BINTRAY_SUBJECT}/${BINTRAY_REPO}/${groupId}/versions/${version}" > /dev/null || { echo "Failed to sync" >&2; exit 1; }
fi fi
......
#!/bin/bash
set -e
buildName=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.name' )
buildNumber=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.number' )
groupId=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/\(.*\):.*:.*/\1/' )
version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' )
echo "Syncing ${buildName}/${buildNumber} to Maven Central"
curl \
-s \
--connect-timeout 240 \
--max-time 2700 \
-u ${BINTRAY_USERNAME}:${BINTRAY_PASSWORD} \
-H "Content-Type: application/json" -d "{\"username\": \"${SONATYPE_USERNAME}\", \"password\": \"${SONATYPE_PASSWORD}\"}" \
-f \
-X \
POST "https://api.bintray.com/maven_central_sync/${BINTRAY_SUBJECT}/${BINTRAY_REPO}/${groupId}/versions/${version}" > /dev/null || { echo "Failed to sync" >&2; exit 1; }
echo "Sync complete"
\ No newline at end of file
---
platform: linux
inputs:
- name: git-repo
- name: artifactory-repo
run:
path: git-repo/ci/scripts/sync-to-maven-central.sh
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment