diff --git a/README.adoc b/README.adoc index e103a983..d34c42f3 100644 --- a/README.adoc +++ b/README.adoc @@ -95,33 +95,6 @@ This will generate the artifacts. You can also import the project into your IDE. -== Releasing Spring Web Services - -Snapshots are published automatically via CI server by doing this: - ----- -$ USERNAME= PASSWORD= ./mvnw -Pdistribute,snapshot,docs clean -Dmaven.test.skip=true deploy ----- - -IMPORTANT: Snapshots do NOT include GPG signatures. To do so would require putting a private key on the CI server. The process for releases (below) is manual and DOES include GPG signatures. - -To do a release (.RELEASE, .RC?, .M?): - -. Check in all changes and ensure there are no edited files. -. Bump up the version in ALL `pom.xml` files to the desired version (e.g. `mvn versions:set -DnewVersion=3.0.0.RC1`) and commit the change. -. `git tag ` (like v3.0.0.RC1) -. Execute a maven test (`./mvnw -Pdistribute,snapshot,docs clean test`). -. Execute a maven deploy. -* For a milestone: `USERNAME= PASSWORD= ./mvnw -Pdistribute,milestone,docs clean -Dmaven.test.skip=true deploy` -* For a release: `USERNAME= PASSWORD= ./mvnw -Pdistribute,release,docs clean -Dmaven.test.skip=true deploy` -* For a release to maven central: `USERNAME= PASSWORD= ./mvnw -Pdistribute,gpg,central,docs clean -Dmaven.test.skip=true deploy -s settings.xml` -. Bump up the version in ALL `pom.xml` files again to the next BUILD-SNAPSHOT. -. Commit the change. -. `git push` (This will push the tagged version along with the release AND the new snapshot commit) -. Inspect handiwork at https://repo.spring.io/ or https://oss.sonatype.org/#stagingRepositories - -NOTE: A word about reference documentation. Based upon https://github.com/spring-projects/spring-framework/wiki/gradle-build-and-release-faq#user-content-wiki-docs_schema_dist_publication[this], the `distribute` profile contains an artifactory property that is applied to the ZIP file generated by the `docs` profile. A CRON job will scoop up the zipped up docs and unpack them inside the target location. - == Code of Conduct This project adheres to the Contributor Covenant link:CODE_OF_CONDUCT.adoc[code of conduct]. diff --git a/ci/README.adoc b/ci/README.adoc index 56787047..9c8bf98b 100644 --- a/ci/README.adoc +++ b/ci/README.adoc @@ -27,20 +27,28 @@ WARNING: Do NOT check this file into source control! If you'll check, `credentia With this in place, run the following `fly` commands to create pipelines: ---- -% fly -t sp -p spring-ws -c ci/pipeline-template.yml -l credentials.yml -v branch=master -% fly -t sp -p spring-ws-2.x -c ci/pipeline-template.yml -l credentials.yml -v branch=2.x +% fly -t spring-team sp -p spring-ws -c ci/pipeline-template.yml -l credentials.yml -v branch=master -v release-branch=release ---- -This creates pipelines for: - -* Spring WS `master` branch -* Spring WS `2.x` branch - With these pipelines in place, you can now activate and expose them: ---- -% fly -t unpause-pipeline -p spring-ws -% fly -t expose-pipeline -p spring-ws -% fly -t unpause-pipeline -p spring-ws-2.x -% fly -t expose-pipeline -p spring-ws-2.x ----- \ No newline at end of file +% fly -t spring-team unpause-pipeline -p spring-ws +% fly -t spring-team expose-pipeline -p spring-ws +---- + +=== Making a release + +1. Create a new release (on the main branch). +---- +% ci/create-release.sh +---- + +2. With the release tagged, push the tagged version to the release branch. +---- +% git checkout -b release +% git reset --hard +% git push -f origin release +---- + +NOTE: You can chain the previous set of commands together using `&&`. \ No newline at end of file diff --git a/ci/create-release.sh b/ci/create-release.sh new file mode 100755 index 00000000..af7ac901 --- /dev/null +++ b/ci/create-release.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -euo pipefail + +RELEASE=$1 +SNAPSHOT=$2 + +# Bump up the version in pom.xml to the desired version and commit the change +./mvnw versions:set -DnewVersion=$RELEASE -DgenerateBackupPoms=false +git add . +git commit --message "Releasing Spring Web Services v$RELEASE" + +# Tag the release +git tag -s v$RELEASE -m "v$RELEASE" + +# Bump up the version in pom.xml to the next snapshot +./mvnw versions:set -DnewVersion=$SNAPSHOT -DgenerateBackupPoms=false +git add . +git commit --message "Continue development on v$SNAPSHOT" + + diff --git a/ci/pipeline-template.yml b/ci/pipeline-template.yml index 29ead2c0..c03aeee5 100644 --- a/ci/pipeline-template.yml +++ b/ci/pipeline-template.yml @@ -57,6 +57,12 @@ resources: repo: spring-projects/spring-ws base: ((branch)) +- name: spring-ws-release + type: git + source: + uri: https://github.com/spring-projects/spring-ws.git + branch: ((release-branch)) + - name: spring-ws-status type: github-status source: @@ -84,6 +90,11 @@ groups: - name: pull-requests jobs: - spring-ws-pull-requests +- name: release + jobs: + - release-to-artifactory + - promote-to-bintray + - sync-to-maven-central jobs: - name: Test - JDK 8 @@ -97,24 +108,8 @@ jobs: - task: test file: spring-ws-github/ci/test.yml params: { PROFILE: "distribute,convergence" } - on_failure: - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has failed" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME - on_success: - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has succeeded!" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + <<: *slack-test-failure + <<: *slack-test-success - name: Test - JDK 8 and Spring.NEXT serial: true @@ -127,24 +122,8 @@ jobs: - task: test file: spring-ws-github/ci/test.yml params: { PROFILE: "springnext,convergence" } - on_failure: - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has failed" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME - on_success: - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has succeeded!" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + <<: *slack-test-failure + <<: *slack-test-success - name: Test - JDK 8 and Spring.NEXT (snapshots) serial: true @@ -157,24 +136,8 @@ jobs: - task: test file: spring-ws-github/ci/test.yml params: { PROFILE: "springnext-buildsnapshot,convergence" } - on_failure: - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has failed" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME - on_success: - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has succeeded!" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + <<: *slack-test-failure + <<: *slack-test-success - name: Test - JDK 8 and Spring (snapshots) serial: true @@ -187,24 +150,8 @@ jobs: - task: test file: spring-ws-github/ci/test.yml params: { PROFILE: "spring-buildsnapshot,convergence" } - on_failure: - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has failed" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME - on_success: - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has succeeded!" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + <<: *slack-test-failure + <<: *slack-test-success - name: Test - JDK 11 serial: true @@ -218,24 +165,8 @@ jobs: image: openjdk:11-jdk file: spring-ws-github/ci/test.yml params: { PROFILE: "distribute,java11,convergence" } - on_failure: - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has failed" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME - on_success: - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has succeeded!" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + <<: *slack-test-failure + <<: *slack-test-success - name: Test - JDK 11 and Spring.NEXT serial: true @@ -249,24 +180,8 @@ jobs: image: openjdk:11-jdk file: spring-ws-github/ci/test.yml params: { PROFILE: "springnext,java11,convergence" } - on_failure: - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has failed" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME - on_success: - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has succeeded!" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + <<: *slack-test-failure + <<: *slack-test-success - name: Test - JDK 11 and Spring.NEXT (snapshots) serial: true @@ -280,24 +195,8 @@ jobs: image: openjdk:11-jdk file: spring-ws-github/ci/test.yml params: { PROFILE: "springnext-buildsnapshot,java11,convergence" } - on_failure: - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has failed" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME - on_success: - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has succeeded!" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + <<: *slack-test-failure + <<: *slack-test-success - name: Test - JDK 11 and Spring (snapshots) serial: true @@ -311,24 +210,8 @@ jobs: image: openjdk:11-jdk file: spring-ws-github/ci/test.yml params: { PROFILE: "spring-buildsnapshot,java11,convergence" } - on_failure: - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has failed" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME - on_success: - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has succeeded!" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + <<: *slack-test-failure + <<: *slack-test-success - name: Build serial: true @@ -362,7 +245,10 @@ jobs: - include: - "/**" properties: - archives: '*:*:*:*@zip zip.name:spring-ws, zip.displayname:Spring Web Services, zip.deployed:false' + zip.deployed: false + zip.displayname: "Spring Web Services" + zip.name: "spring-ws" + zip.type: "docs" on_failure: aggregate: - put: spring-ws-status @@ -461,3 +347,176 @@ jobs: text: "Build has succeeded!" title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + +- name: release-to-artifactory + serial: true + public: true + plan: + - get: spring-ws-github + resource: spring-ws-release + trigger: true + - put: spring-ws-status + params: + commit: spring-ws-release + state: pending + - task: build + file: spring-ws-github/ci/build.yml + - put: spring-ws-artifactory + params: + build_number: ${BUILD_NAME} + build_uri: ${ATC_EXTERNAL_URL}/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME} + repo: libs-release-local + folder: spring-ws-artifactory + artifact_set: + - include: + - "/**" + properties: + zip.deployed: false + zip.displayname: "Spring HATEOAS" + zip.name: "spring-ws" + zip.type: "docs" + on_failure: + aggregate: + - put: spring-ws-status + params: + commit: spring-ws-github + state: failure + - put: slack + params: + attachments: + - color: danger + fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " + text: "Releasing to artifactory has failed" + title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" + title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + on_success: + aggregate: + - put: spring-ws-status + params: + commit: spring-ws-github + state: success + - put: slack + params: + attachments: + - color: good + fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " + text: "Releasing to artifactory has succeeded!" + title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" + title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + +- name: promote-to-bintray + serial: true + plan: + - get: spring-ws-github + resource: spring-ws-release + - get: spring-ws-artifactory + trigger: true + passed: [release-to-artifactory] + params: + save_build_info: true + - task: promote-to-bintray + file: spring-ws-github/ci/promote-to-bintray.yml + params: + ARTIFACTORY_USERNAME: ((artifactory-username)) + ARTIFACTORY_PASSWORD: ((artifactory-password)) + on_failure: + aggregate: + - put: spring-ws-status + params: + commit: spring-ws-github + state: failure + - put: slack + params: + attachments: + - color: danger + fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " + text: "Promoting to bintray has failed" + title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" + title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + on_success: + aggregate: + - put: spring-ws-status + params: + commit: spring-ws-github + state: success + - put: slack + params: + attachments: + - color: good + fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " + text: "Promoting to bintray has succeeded!" + title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" + title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + +- name: sync-to-maven-central + serial: true + plan: + - get: spring-ws-github + resource: spring-ws-release + - get: spring-ws-artifactory + trigger: true + passed: [promote-to-bintray] + params: + save_build_info: true + - task: sync-to-maven-central + file: spring-ws-github/ci/sync-to-maven-central.yml + params: + BINTRAY_USERNAME: ((bintray-username)) + BINTRAY_API_KEY: ((bintray-api-key)) + SONATYPE_USER_TOKEN: ((sonatype-user-token)) + SONATYPE_PASSWORD_TOKEN: ((sonatype-user-token-password)) + ARTIFACTORY_USERNAME: ((artifactory-username)) + ARTIFACTORY_PASSWORD: ((artifactory-password)) + on_failure: + aggregate: + - put: spring-ws-status + params: + commit: spring-ws-github + state: failure + - put: slack + params: + attachments: + - color: danger + fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " + text: "Syncing to maven central has failed" + title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" + title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + on_success: + aggregate: + - put: spring-ws-status + params: + commit: spring-ws-github + state: success + - put: slack + params: + attachments: + - color: good + fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " + text: "Syncing to maven central has succeeded!" + title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" + title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + + +slack-test-success: &slack-test-success + on_success: + put: slack + params: + attachments: + - color: good + fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " + text: "Test has succeeded" + title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" + title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + +slack-test-failure: &slack-test-failure + on_failure: + put: slack + params: + attachments: + - color: danger + fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " + text: "Test has failed" + title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" + title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME + + diff --git a/ci/promote-to-bintray.sh b/ci/promote-to-bintray.sh new file mode 100755 index 00000000..5a41804b --- /dev/null +++ b/ci/promote-to-bintray.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -e -u + +apt-get update +apt-get install -y jq + +buildName=$( cat spring-ws-artifactory/build-info.json | jq -r '.buildInfo.name' ) +buildNumber=$( cat spring-ws-artifactory/build-info.json | jq -r '.buildInfo.number' ) +groupId=$( cat spring-ws-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/\(.*\):.*:.*/\1/' ) +version=$( cat spring-ws-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' ) +targetRepo="libs-release-local" + +echo "Promoting ${buildName}/${buildNumber} to ${targetRepo}" + +curl \ + -s \ + --connect-timeout 240 \ + --max-time 2700 \ + -u ${ARTIFACTORY_USERNAME}:${ARTIFACTORY_PASSWORD} \ + -H "Content-type:application/json" \ + -d "{\"sourceRepos\": [\"libs-release-local\"], \"targetRepo\" : \"spring-distributions\", \"async\":\"true\"}" \ + -f \ + -X \ + POST "https://repo.spring.io/api/build/distribute/${buildName}/${buildNumber}" > /dev/null || { echo "Failed to distribute" >&2; exit 1; } + +echo "Waiting for artifacts to be published" + +ARTIFACTS_PUBLISHED=false +WAIT_TIME=10 +COUNTER=0 + +while [ $ARTIFACTS_PUBLISHED == "false" ] && [ $COUNTER -lt 120 ]; do + + result=$( curl -s https://api.bintray.com/packages/spring/jars/"${groupId}" ) + versions=$( echo "$result" | jq -r '.versions' ) + exists=$( echo "$versions" | grep "$version" -o || true ) + + if [ "$exists" = "$version" ]; then + ARTIFACTS_PUBLISHED=true + fi + + COUNTER=$(( COUNTER + 1 )) + sleep $WAIT_TIME + +done diff --git a/ci/promote-to-bintray.yml b/ci/promote-to-bintray.yml new file mode 100644 index 00000000..b7d164a1 --- /dev/null +++ b/ci/promote-to-bintray.yml @@ -0,0 +1,19 @@ +--- +platform: linux + +image_resource: + type: docker-image + source: + repository: openjdk + tag: 8-jdk + +inputs: +- name: spring-ws-artifactory +- name: spring-ws-github + +run: + path: spring-ws-github/ci/promote-to-bintray.sh + +params: + ARTIFACTORY_USERNAME: + ARTIFACTORY_PASSWORD: diff --git a/ci/sync-to-maven-central.sh b/ci/sync-to-maven-central.sh new file mode 100755 index 00000000..9be92518 --- /dev/null +++ b/ci/sync-to-maven-central.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e -u + +apt-get update +apt-get install -y jq + +buildName=$( cat spring-ws-artifactory/build-info.json | jq -r '.buildInfo.name' ) +buildNumber=$( cat spring-ws-artifactory/build-info.json | jq -r '.buildInfo.number' ) +groupId=$( cat spring-ws-artifactory/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/\(.*\):.*:.*/\1/' ) +version=$( cat spring-ws-artifactory/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_API_KEY} \ + -H "Content-Type: application/json" -d "{ \"username\": \"${SONATYPE_USER_TOKEN}\", \"password\": \"${SONATYPE_PASSWORD_TOKEN}\"}" \ + -f \ + -X \ + POST "https://api.bintray.com/maven_central_sync/spring/jars/${groupId}/versions/${version}" > /dev/null || { echo "Failed to sync" >&2; exit 1; } + +echo "Sync complete" diff --git a/ci/sync-to-maven-central.yml b/ci/sync-to-maven-central.yml new file mode 100644 index 00000000..7e214694 --- /dev/null +++ b/ci/sync-to-maven-central.yml @@ -0,0 +1,21 @@ +--- +platform: linux + +image_resource: + type: docker-image + source: + repository: openjdk + tag: 8-jdk + +inputs: +- name: spring-ws-artifactory +- name: spring-ws-github + +run: + path: spring-ws-github/ci/sync-to-maven-central.sh + +params: + BINTRAY_USERNAME: + BINTRAY_API_KEY: + SONATYPE_USER_TOKEN: + SONATYPE_PASSWORD_TOKEN: