Skip to content

Commit ea3d9b4

Browse files
committed
Update publish release notes script
The milestone name and tag name can be different if the release type is ".RELEASE".
1 parent 885948c commit ea3d9b4

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

ci/pipeline.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ jobs:
329329
image: spring-boot-ci-image
330330
file: git-repo/ci/tasks/publish-release-notes.yml
331331
params:
332+
RELEASE_TYPE: M
332333
GITHUB_ORGANIZATION: spring-projects
333334
GITHUB_REPO: spring-boot
334335
GITHUB_USERNAME: ((github-username))
@@ -339,6 +340,7 @@ jobs:
339340
- get: spring-boot-ci-image
340341
- get: git-repo
341342
trigger: false
343+
- get: release-notes-repo
342344
- task: stage
343345
image: spring-boot-ci-image
344346
file: git-repo/ci/tasks/stage.yml
@@ -355,6 +357,7 @@ jobs:
355357
image: spring-boot-ci-image
356358
file: git-repo/ci/tasks/publish-release-notes.yml
357359
params:
360+
RELEASE_TYPE: RC
358361
GITHUB_ORGANIZATION: spring-projects
359362
GITHUB_REPO: spring-boot
360363
GITHUB_USERNAME: ((github-username))
@@ -365,6 +368,7 @@ jobs:
365368
- get: spring-boot-ci-image
366369
- get: git-repo
367370
trigger: false
371+
- get: release-notes-repo
368372
- task: stage
369373
image: spring-boot-ci-image
370374
file: git-repo/ci/tasks/stage.yml
@@ -381,6 +385,7 @@ jobs:
381385
image: spring-boot-ci-image
382386
file: git-repo/ci/tasks/publish-release-notes.yml
383387
params:
388+
RELEASE_TYPE: RELEASE
384389
GITHUB_ORGANIZATION: spring-projects
385390
GITHUB_REPO: spring-boot
386391
GITHUB_USERNAME: ((github-username))

ci/scripts/publish-release-notes.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ set -e
33

44
source $(dirname $0)/common.sh
55

6-
latest=$( curl -s "https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/releases/latest" -u ${GITHUB_USERNAME}:${GITHUB_PASSWORD} )
7-
id=$( echo $latest | jq -r '.id' )
8-
96
milestone=$( cat version/stageVersion )
7+
if [[ $RELEASE_TYPE = "RELEASE" ]]; then
8+
milestone=${milestone%.RELEASE}
9+
fi
1010
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')
1111

1212
pushd release-notes-repo > /dev/null
@@ -21,7 +21,7 @@ curl \
2121
-s \
2222
-u ${GITHUB_USERNAME}:${GITHUB_PASSWORD} \
2323
-H "Content-type:application/json" \
24-
-d "{\"body\": \"${body}\"}" \
24+
-d "{\"tag_name\":\"v{$milestone}\",\"name\":\"v{$milestone}\",\"body\": \"${body}\"}" \
2525
-f \
2626
-X \
27-
PATCH "https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/releases/${id}" > /dev/null || { echo "Failed to publish" >&2; exit 1; }
27+
POST "https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/releases" > /dev/null || { echo "Failed to publish" >&2; exit 1; }

ci/tasks/publish-release-notes.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ params:
99
GITHUB_REPO:
1010
GITHUB_USERNAME:
1111
GITHUB_PASSWORD:
12+
RELEASE_TYPE:
1213
run:
1314
path: git-repo/ci/scripts/publish-release-notes.sh

0 commit comments

Comments
 (0)