Skip to content

Commit 415b9ab

Browse files
authored
Generate release notes from change log (#249)
* Generate release notes from change log * Update release instructions * Patch releases too
1 parent 6e41073 commit 415b9ab

File tree

4 files changed

+67
-11
lines changed

4 files changed

+67
-11
lines changed

.github/workflows/patch-release-build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,33 @@ jobs:
126126
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
127127
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
128128

129+
- name: Set SDK version
130+
id: set-sdk-version
131+
run: |
132+
v=$(grep -Po "io.opentelemetry:opentelemetry-bom:\K[0-9]+.[0-9]+.0" dependencyManagement/build.gradle.kts)
133+
echo "::set-output name=sdk-version::$v"
134+
135+
- name: Generate Release Notes
136+
env:
137+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138+
run: |
139+
cat > release-notes.txt << EOF
140+
This release targets the OpenTelemetry SDK ${{ steps.set-sdk-version.outputs.sdk-version }}.
141+
142+
EOF
143+
144+
sed -n '/^## Version ${{ github.event.inputs.version }}/,/^## Version /p' CHANGELOG.md \
145+
| head -n -1 \
146+
| perl -0pe 's/^\n+//g' \
147+
| perl -0pe 's/\n+$/\n/g' \
148+
| sed -r 's,\[#([0-9]+)]\(https://github.com/open-telemetry/opentelemetry-java-contrib/pull/[0-9]+\),#\1,' \
149+
| perl -0pe 's/\n +/ /g' \
150+
>> release-notes.txt
151+
152+
cat >> release-notes.txt << EOF
153+
154+
EOF
155+
129156
- name: Create Release
130157
id: create_release
131158
uses: actions/[email protected]
@@ -136,6 +163,7 @@ jobs:
136163
release_name: Version ${{ github.event.inputs.version }}
137164
draft: true
138165
prerelease: false
166+
body_path: release-notes.txt
139167

140168
- name: Upload jmx-metrics release asset
141169
id: upload-release-asset-jmx-metrics

.github/workflows/release-build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,33 @@ jobs:
8585
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
8686
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
8787

88+
- name: Set SDK version
89+
id: set-sdk-version
90+
run: |
91+
v=$(grep -Po "io.opentelemetry:opentelemetry-bom:\K[0-9]+.[0-9]+.0" dependencyManagement/build.gradle.kts)
92+
echo "::set-output name=sdk-version::$v"
93+
94+
- name: Generate Release Notes
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
run: |
98+
cat > release-notes.txt << EOF
99+
This release targets the OpenTelemetry SDK ${{ steps.set-sdk-version.outputs.sdk-version }}.
100+
101+
EOF
102+
103+
sed -n '/^## Version ${{ github.event.inputs.version }}/,/^## Version /p' CHANGELOG.md \
104+
| head -n -1 \
105+
| perl -0pe 's/^\n+//g' \
106+
| perl -0pe 's/\n+$/\n/g' \
107+
| sed -r 's,\[#([0-9]+)]\(https://github.com/open-telemetry/opentelemetry-java-contrib/pull/[0-9]+\),#\1,' \
108+
| perl -0pe 's/\n +/ /g' \
109+
>> release-notes.txt
110+
111+
cat >> release-notes.txt << EOF
112+
113+
EOF
114+
88115
- name: Create Release
89116
id: create_release
90117
uses: actions/[email protected]
@@ -95,6 +122,7 @@ jobs:
95122
release_name: Version ${{ github.event.inputs.version }}
96123
draft: true
97124
prerelease: false
125+
body_path: release-notes.txt
98126

99127
- name: Upload jmx-metrics release asset
100128
id: upload-release-asset-jmx-metrics

RELEASING.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ to release in the input field that pops up, and then press "Run workflow".
2727
This triggers the release process, which builds the artifacts, publishes the artifacts, and creates
2828
and pushes a git tag with the version number.
2929

30-
## Announcement
31-
32-
Once the GitHub workflow completes, go to Github [release
33-
page](https://github.com/open-telemetry/opentelemetry-java-contrib/releases), press
34-
`Draft a new release` to write release notes about the new release. If there is already a draft
35-
release notes, just point it at the created tag. You can use the script at
36-
`buildscripts/draft-release-notes.sh` to generate release notes from the change log.
30+
Once the GitHub workflow completes, go to Github
31+
[release page](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases),
32+
find the draft release created by the release workflow, and
33+
* Select the checkbox for "Create a discussion for this release"
34+
* Press the "Publish release" button
3735

3836
### Notifying other OpenTelemetry projects
3937

@@ -89,3 +87,9 @@ applied automatically, we need to do code review to make sure the manual cherryp
8987
After it is merged, Run the patch release workflow again, but leave the commits input field blank.
9088
The release will be made with the current state of the release branch, which is what you prepared
9189
above.
90+
91+
Once the GitHub workflow completes, go to Github
92+
[release page](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases),
93+
find the draft release created by the release workflow, and
94+
* Select the checkbox for "Create a discussion for this release"
95+
* Press the "Publish release" button

buildscripts/draft-release-notes.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)