Add a separate job for syncing release to central

See gh-12292
This commit is contained in:
Madhura Bhave 2018-03-12 17:07:15 -07:00
parent 6d9692ffb7
commit 0b64ac07c6
4 changed files with 40 additions and 11 deletions

View File

@ -345,6 +345,19 @@ jobs:
ARTIFACTORY_SERVER: ((artifactory-server))
ARTIFACTORY_USERNAME: ((artifactory-username))
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_PASSWORD: ((bintray-password))
SONATYPE_USERNAME: ((sonatype-username))
@ -355,7 +368,7 @@ groups:
- name: "Build"
jobs: ["build", "jdk9-build", "jdk10-build"]
- 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"
jobs: ["build-spring-boot-ci-images"]
- name: "Build Pull Requests"

View File

@ -43,16 +43,6 @@ if [[ $RELEASE_TYPE = "RELEASE" ]]; then
-f \
-X \
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

View File

@ -0,0 +1,19 @@
#!/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"

View File

@ -0,0 +1,7 @@
---
platform: linux
inputs:
- name: git-repo
- name: artifactory-repo
run:
path: git-repo/ci/scripts/sync-to-maven-central.sh