diff --git a/ci/pipeline.yml b/ci/pipeline.yml index c001150a1f..3bd00a481e 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -392,6 +392,7 @@ jobs: image: spring-boot-ci-image file: git-repo/ci/tasks/publish-release-notes.yml params: + RELEASE_TYPE: M GITHUB_ORGANIZATION: spring-projects GITHUB_REPO: spring-boot GITHUB_USERNAME: ((github-username)) @@ -402,6 +403,7 @@ jobs: - get: spring-boot-ci-image - get: git-repo trigger: false + - get: release-notes-repo - task: stage image: spring-boot-ci-image file: git-repo/ci/tasks/stage.yml @@ -418,6 +420,7 @@ jobs: image: spring-boot-ci-image file: git-repo/ci/tasks/publish-release-notes.yml params: + RELEASE_TYPE: RC GITHUB_ORGANIZATION: spring-projects GITHUB_REPO: spring-boot GITHUB_USERNAME: ((github-username)) @@ -428,6 +431,7 @@ jobs: - get: spring-boot-ci-image - get: git-repo trigger: false + - get: release-notes-repo - task: stage image: spring-boot-ci-image file: git-repo/ci/tasks/stage.yml @@ -444,6 +448,7 @@ jobs: image: spring-boot-ci-image file: git-repo/ci/tasks/publish-release-notes.yml params: + RELEASE_TYPE: RELEASE GITHUB_ORGANIZATION: spring-projects GITHUB_REPO: spring-boot GITHUB_USERNAME: ((github-username)) diff --git a/ci/scripts/publish-release-notes.sh b/ci/scripts/publish-release-notes.sh index 0f1ded7562..c5b7144962 100644 --- a/ci/scripts/publish-release-notes.sh +++ b/ci/scripts/publish-release-notes.sh @@ -3,10 +3,10 @@ set -e source $(dirname $0)/common.sh -latest=$( curl -s "https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/releases/latest" -u ${GITHUB_USERNAME}:${GITHUB_PASSWORD} ) -id=$( echo $latest | jq -r '.id' ) - milestone=$( cat version/stageVersion ) +if [[ $RELEASE_TYPE = "RELEASE" ]]; then + milestone=${milestone%.RELEASE} +fi milestone_number=$( curl -s "https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/milestones" -u ${GITHUB_USERNAME}:${GITHUB_PASSWORD} | jq -r --arg MILESTONE "${milestone}" '.[] | select(.title == $MILESTONE) | .number') pushd release-notes-repo > /dev/null @@ -21,7 +21,7 @@ curl \ -s \ -u ${GITHUB_USERNAME}:${GITHUB_PASSWORD} \ -H "Content-type:application/json" \ - -d "{\"body\": \"${body}\"}" \ + -d "{\"tag_name\":\"v{$milestone}\",\"name\":\"v{$milestone}\",\"body\": \"${body}\"}" \ -f \ -X \ - PATCH "https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/releases/${id}" > /dev/null || { echo "Failed to publish" >&2; exit 1; } + POST "https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/releases" > /dev/null || { echo "Failed to publish" >&2; exit 1; } diff --git a/ci/tasks/publish-release-notes.yml b/ci/tasks/publish-release-notes.yml index 64b286468f..87462a0e9a 100755 --- a/ci/tasks/publish-release-notes.yml +++ b/ci/tasks/publish-release-notes.yml @@ -9,5 +9,6 @@ params: GITHUB_REPO: GITHUB_USERNAME: GITHUB_PASSWORD: + RELEASE_TYPE: run: path: git-repo/ci/scripts/publish-release-notes.sh