From f145e813540e8a524f4fbdbf6ab184d255c97a0f Mon Sep 17 00:00:00 2001 From: Madhura Bhave Date: Fri, 19 Oct 2018 16:08:36 -0700 Subject: [PATCH] Use github release resource for publishing release notes This commit also marks a release as pre-release for milestones and RCs Closes gh-14908 Closes gh-14875 --- ci/pipeline.yml | 41 ++++++++++++++++--- ...ase-notes.sh => generate-release-notes.sh} | 13 +----- ...e-notes.yml => generate-release-notes.yml} | 4 +- 3 files changed, 40 insertions(+), 18 deletions(-) rename ci/scripts/{publish-release-notes.sh => generate-release-notes.sh} (62%) rename ci/tasks/{publish-release-notes.yml => generate-release-notes.yml} (67%) diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 43180d1c9d..a891605b24 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -39,6 +39,20 @@ resources: repo: ((github-repo-name)) base: ((branch)) ignore_paths: ["ci/*"] +- name: github-pre-release + type: github-release + source: + owner: spring-projects + repository: spring-boot + access_token: ((github-release-notes-access-token)) + pre_release: true +- name: github-release + type: github-release + source: + owner: spring-projects + repository: spring-boot + access_token: ((github-release-notes-access-token)) + pre_release: false - name: ci-images-git-repo type: git source: @@ -380,15 +394,20 @@ jobs: ARTIFACTORY_SERVER: ((artifactory-server)) ARTIFACTORY_USERNAME: ((artifactory-username)) ARTIFACTORY_PASSWORD: ((artifactory-password)) - - task: publish-release-notes + - task: generate-release-notes image: spring-boot-ci-image - file: git-repo/ci/tasks/publish-release-notes.yml + file: git-repo/ci/tasks/generate-release-notes.yml params: RELEASE_TYPE: M GITHUB_ORGANIZATION: spring-projects GITHUB_REPO: spring-boot GITHUB_USERNAME: ((github-username)) GITHUB_PASSWORD: ((github-release-notes-access-token)) + - put: github-pre-release + params: + name: generated-release-notes/version + tag: generated-release-notes/version + body: generated-release-notes/body - name: promote-rc serial: true plan: @@ -409,15 +428,20 @@ jobs: ARTIFACTORY_SERVER: ((artifactory-server)) ARTIFACTORY_USERNAME: ((artifactory-username)) ARTIFACTORY_PASSWORD: ((artifactory-password)) - - task: publish-release-notes + - task: generate-release-notes image: spring-boot-ci-image - file: git-repo/ci/tasks/publish-release-notes.yml + file: git-repo/ci/tasks/generate-release-notes.yml params: RELEASE_TYPE: RC GITHUB_ORGANIZATION: spring-projects GITHUB_REPO: spring-boot GITHUB_USERNAME: ((github-username)) GITHUB_PASSWORD: ((github-release-notes-access-token)) + - put: github-pre-release + params: + name: generated-release-notes/version + tag: generated-release-notes/version + body: generated-release-notes/body - name: promote-release serial: true plan: @@ -440,15 +464,20 @@ jobs: ARTIFACTORY_PASSWORD: ((artifactory-password)) BINTRAY_SUBJECT: ((bintray-subject)) BINTRAY_REPO: ((bintray-repo)) - - task: publish-release-notes + - task: generate-release-notes image: spring-boot-ci-image - file: git-repo/ci/tasks/publish-release-notes.yml + file: git-repo/ci/tasks/generate-release-notes.yml params: RELEASE_TYPE: RELEASE GITHUB_ORGANIZATION: spring-projects GITHUB_REPO: spring-boot GITHUB_USERNAME: ((github-username)) GITHUB_PASSWORD: ((github-release-notes-access-token)) + - put: github-release + params: + name: generated-release-notes/version + tag: generated-release-notes/version + body: generated-release-notes/body - name: sync-to-maven-central serial: true plan: diff --git a/ci/scripts/publish-release-notes.sh b/ci/scripts/generate-release-notes.sh similarity index 62% rename from ci/scripts/publish-release-notes.sh rename to ci/scripts/generate-release-notes.sh index 6bd177bbfd..f3b915fcfd 100755 --- a/ci/scripts/publish-release-notes.sh +++ b/ci/scripts/generate-release-notes.sh @@ -15,14 +15,5 @@ run_maven clean install java -jar -Dreleasenotes.github.organization=${GITHUB_ORGANIZATION} -Dreleasenotes.github.name=${GITHUB_REPO} target/github-release-notes-generator-0.0.1-SNAPSHOT.jar "${milestone_number}" release-notes.md popd > /dev/null - -body=$( sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' release-notes-repo/release-notes.md ) - -curl \ - -s \ - -u ${GITHUB_USERNAME}:${GITHUB_PASSWORD} \ - -H "Content-type:application/json" \ - -d "{\"tag_name\":\"v${version}\",\"name\":\"v${version}\",\"body\": \"${body}\"}" \ - -f \ - -X \ - POST "https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/releases" > /dev/null || { echo "Failed to publish" >&2; exit 1; } +cat release-notes-repo/release-notes.md > generated-release-notes/body +echo v${version} > generated-release-notes/version diff --git a/ci/tasks/publish-release-notes.yml b/ci/tasks/generate-release-notes.yml similarity index 67% rename from ci/tasks/publish-release-notes.yml rename to ci/tasks/generate-release-notes.yml index 87462a0e9a..fde7d8caff 100755 --- a/ci/tasks/publish-release-notes.yml +++ b/ci/tasks/generate-release-notes.yml @@ -4,6 +4,8 @@ inputs: - name: git-repo - name: release-notes-repo - name: version +outputs: +- name: generated-release-notes params: GITHUB_ORGANIZATION: GITHUB_REPO: @@ -11,4 +13,4 @@ params: GITHUB_PASSWORD: RELEASE_TYPE: run: - path: git-repo/ci/scripts/publish-release-notes.sh + path: git-repo/ci/scripts/generate-release-notes.sh