Commit ea3d9b4e authored by Madhura Bhave's avatar Madhura Bhave

Update publish release notes script

The milestone name and tag name can be different if the release type
is ".RELEASE".
parent 885948ce
...@@ -329,6 +329,7 @@ jobs: ...@@ -329,6 +329,7 @@ jobs:
image: spring-boot-ci-image image: spring-boot-ci-image
file: git-repo/ci/tasks/publish-release-notes.yml file: git-repo/ci/tasks/publish-release-notes.yml
params: params:
RELEASE_TYPE: M
GITHUB_ORGANIZATION: spring-projects GITHUB_ORGANIZATION: spring-projects
GITHUB_REPO: spring-boot GITHUB_REPO: spring-boot
GITHUB_USERNAME: ((github-username)) GITHUB_USERNAME: ((github-username))
...@@ -339,6 +340,7 @@ jobs: ...@@ -339,6 +340,7 @@ jobs:
- get: spring-boot-ci-image - get: spring-boot-ci-image
- get: git-repo - get: git-repo
trigger: false trigger: false
- get: release-notes-repo
- task: stage - task: stage
image: spring-boot-ci-image image: spring-boot-ci-image
file: git-repo/ci/tasks/stage.yml file: git-repo/ci/tasks/stage.yml
...@@ -355,6 +357,7 @@ jobs: ...@@ -355,6 +357,7 @@ jobs:
image: spring-boot-ci-image image: spring-boot-ci-image
file: git-repo/ci/tasks/publish-release-notes.yml file: git-repo/ci/tasks/publish-release-notes.yml
params: params:
RELEASE_TYPE: RC
GITHUB_ORGANIZATION: spring-projects GITHUB_ORGANIZATION: spring-projects
GITHUB_REPO: spring-boot GITHUB_REPO: spring-boot
GITHUB_USERNAME: ((github-username)) GITHUB_USERNAME: ((github-username))
...@@ -365,6 +368,7 @@ jobs: ...@@ -365,6 +368,7 @@ jobs:
- get: spring-boot-ci-image - get: spring-boot-ci-image
- get: git-repo - get: git-repo
trigger: false trigger: false
- get: release-notes-repo
- task: stage - task: stage
image: spring-boot-ci-image image: spring-boot-ci-image
file: git-repo/ci/tasks/stage.yml file: git-repo/ci/tasks/stage.yml
...@@ -381,6 +385,7 @@ jobs: ...@@ -381,6 +385,7 @@ jobs:
image: spring-boot-ci-image image: spring-boot-ci-image
file: git-repo/ci/tasks/publish-release-notes.yml file: git-repo/ci/tasks/publish-release-notes.yml
params: params:
RELEASE_TYPE: RELEASE
GITHUB_ORGANIZATION: spring-projects GITHUB_ORGANIZATION: spring-projects
GITHUB_REPO: spring-boot GITHUB_REPO: spring-boot
GITHUB_USERNAME: ((github-username)) GITHUB_USERNAME: ((github-username))
......
...@@ -3,10 +3,10 @@ set -e ...@@ -3,10 +3,10 @@ set -e
source $(dirname $0)/common.sh 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 ) 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') 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 pushd release-notes-repo > /dev/null
...@@ -21,7 +21,7 @@ curl \ ...@@ -21,7 +21,7 @@ curl \
-s \ -s \
-u ${GITHUB_USERNAME}:${GITHUB_PASSWORD} \ -u ${GITHUB_USERNAME}:${GITHUB_PASSWORD} \
-H "Content-type:application/json" \ -H "Content-type:application/json" \
-d "{\"body\": \"${body}\"}" \ -d "{\"tag_name\":\"v{$milestone}\",\"name\":\"v{$milestone}\",\"body\": \"${body}\"}" \
-f \ -f \
-X \ -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; }
...@@ -9,5 +9,6 @@ params: ...@@ -9,5 +9,6 @@ params:
GITHUB_REPO: GITHUB_REPO:
GITHUB_USERNAME: GITHUB_USERNAME:
GITHUB_PASSWORD: GITHUB_PASSWORD:
RELEASE_TYPE:
run: run:
path: git-repo/ci/scripts/publish-release-notes.sh path: git-repo/ci/scripts/publish-release-notes.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