Skip to content

Commit b5d6d27

Browse files
Generate release notes automatically from pull requests (#3174)
This alleviates two issues: 1. Developers routinely hit conflicts on their pull requests, requiring merging. The original code had attempted to alleviate this by having multiple different items that could be replaced by category, but it was insufficient. 2. In part due to the above, presumably, a lot of release notes in the past were sparse, by generating it automatically from the PR, this will be much harder. I considered just using GitHub's `generate-notes` functionality, but that is rather limited. This change doesn't really expand on using that yet, but puts us in a better place to do so. This also updates the release workflow to use the new script, and updates the release notes so that they have the new format for every version since `4.0.559.0`. This also means the release notes now include the patch releases of `4.0.559.*`. I also did some manual additions to the release notes. --------- Co-authored-by: Alec Grieser <[email protected]>
1 parent ccb6246 commit b5d6d27

File tree

7 files changed

+670
-107
lines changed

7 files changed

+670
-107
lines changed

.github/release.yml

-24
This file was deleted.

.github/workflows/patch_release.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,25 @@ jobs:
2323
with:
2424
ref: ${{ inputs.branch }}
2525
ssh-key: ${{ secrets.DEPLOY_KEY }}
26+
fetch-tags: true
27+
# fetch all the history to make sure that we have the last release
28+
# I tried fetching part of the history, but I just couldn't get it to work, and fetching all still takes like 5s
29+
fetch-depth: 0
2630
- name: Setup Base Environment
2731
uses: ./actions/setup-base-env
2832
- name: Setup FDB
2933
uses: ./actions/setup-fdb
30-
31-
# Push a version bump back to main. There are failure scenarios that can result
32-
# in published artifacts but an erroneous build, so it's safer to bump the version
33-
# at the beginning
3434
- name: Configure Git
3535
run: |
3636
git config --global user.name 'FoundationDB CI'
3737
git config --global user.email '[email protected]'
38-
- name: Increment Version
39-
run: python build/versionutils.py gradle.properties -u PATCH --increment --commit
40-
- name: Push Version Update
41-
run: git push
4238
4339
- name: Build and publish release
4440
uses: ./actions/release-build-publish
4541
with:
4642
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
4743
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
44+
update_type: PATCH
4845
env:
4946
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5047
MAVEN_USER: ${{ secrets.MAVEN_USER }}

.github/workflows/release.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,26 @@ jobs:
1616
uses: actions/[email protected]
1717
with:
1818
ssh-key: ${{ secrets.DEPLOY_KEY }}
19+
fetch-tags: true
20+
# fetch all the history to make sure that we have the last release
21+
# I tried fetching part of the history, but I just couldn't get it to work, and fetching all still takes like 5s
22+
fetch-depth: 0
1923
- name: Setup Base Environment
2024
id: setup-base
2125
uses: ./actions/setup-base-env
2226
- name: Setup FDB
2327
uses: ./actions/setup-fdb
24-
25-
# Push a version bump back to main. There are failure scenarios that can result
26-
# in published artifacts but an erroneous build, so it's safer to bump the version
27-
# at the beginning
2828
- name: Configure git
2929
run: |
3030
git config --global user.name 'FoundationDB CI'
3131
git config --global user.email '[email protected]'
32-
- name: Increment version
33-
run: python build/versionutils.py gradle.properties --increment --commit
34-
- name: Push version increment
35-
run: git push
3632
3733
- name: Build and publish
3834
uses: ./actions/release-build-publish
3935
with:
4036
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
4137
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
38+
update_type: BUILD
4239
env:
4340
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4441
MAVEN_USER: ${{ secrets.MAVEN_USER }}

CONTRIBUTING.md

+23-7
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ importantly, it keeps the community open and communicative.
7171

7272
### Opening a Pull Request
7373

74-
When opening a pull request (PR), please ensure that the title of the pull request
74+
When opening a pull request (PR), please ensure that the description of the pull request
7575
or the commit message indicates the issue that it is addressing (see
7676
[Closing issues with keywords](https://help.github.com/articles/closing-issues-using-keywords/)).
7777
For example:
@@ -82,12 +82,28 @@ This will automatically create an association between the PR and the issue that
8282
it is addressing and, upon merging of the PR into the main code line, will
8383
automatically mark the issue as resolved.
8484

85-
If your pull request results in a user-visible change to the Record Layer, you should
86-
also update the [release notes](docs/sphinx/source/ReleaseNotes.md). For most changes, it
87-
is sufficient to fill in one of the bullets in the "next release" section of that
88-
document. You should include a short description of the change as well as filling in
89-
the issue number. The "next release" section is commented out, so the change won't
90-
be visible in our documentation until the next time a release is cut.
85+
PRs should have titles that clearly indicate what the change is accomplishing
86+
as we use these to generate release notes. You can glance at
87+
[release notes](docs/sphinx/source/ReleaseNotes.md) for inspiration.
88+
89+
They should also have one of the following labels:
90+
- `breaking change`: For any breaking change
91+
- `enhancement`: For any new feature or enhancement
92+
- `bug fix`: For bug fixes
93+
- `performance`: For performance improvements
94+
- `dependencies`: For updates to dependency versions
95+
- `build improvement`: For updates to our build system that shouldn't have user visible impacts
96+
- `testing improvement`: For new test coverage, or improvements to testing infrastructure
97+
- `documentation`: For improvements to our documentation
98+
99+
(Note: `build improvement`/`testing improvement`/`documentation` are combined in one
100+
grouping in the release notes, that is collapsed).
101+
102+
[release-notes-config.json](build/release-notes-config.json) describes how labels are
103+
converted into categories in the release notes.
104+
If a PR has multiple labels, it will appear in the first grouping as listed above /
105+
in [release-notes-config.json](build/release-notes-config.json) (i.e., if it is has
106+
`enhancement` and `dependencies`, it will only appear under `enhancement`).
91107

92108
### Reporting issues
93109

actions/release-build-publish/action.yml

+51-16
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,58 @@ inputs:
77
gpg_passphrase:
88
description: 'GPG passphrase for artifact signing'
99
required: true
10+
update_type:
11+
description: 'One of MAJOR, MINOR, BUILD, PATCH'
12+
required: true
1013

1114
runs:
1215
using: "composite"
1316
steps:
14-
- name: Get version
15-
id: get_version
17+
- name: Get old version
18+
id: get_old_version
19+
shell: bash
20+
run: |
21+
echo "version=$(python build/versionutils.py gradle.properties)" >> "$GITHUB_OUTPUT"
22+
# Push a version bump back to main. There are failure scenarios that can result
23+
# in published artifacts but an erroneous build, so it's safer to bump the version
24+
# at the beginning
25+
- name: Increment version
26+
shell: bash
27+
run: python build/versionutils.py gradle.properties --increment --commit -u ${{ inputs.update_type }}
28+
- name: Get new version
29+
id: get_new_version
1630
shell: bash
1731
run: |
1832
echo "version=$(python build/versionutils.py gradle.properties)" >> "$GITHUB_OUTPUT"
33+
# We also want to push the tag, because that will be used for the next release's release notes
34+
- name: Create tag
35+
shell: bash
36+
run: git tag -m "Release ${{ steps.get_new_version.outputs.version }}" -f "${{ steps.get_new_version.outputs.version }}"
37+
38+
# We want to do this before anything else, because if the later steps fail, we want to make sure that the full
39+
# change log includes all changes, even if they reference a release that was never actually published.
40+
- name: Update release notes
41+
shell: bash
42+
run: |
43+
python ./build/create_release_notes.py \
44+
--config ./build/release-notes-config.json \
45+
--release-notes-md docs/sphinx/source/ReleaseNotes.md \
46+
--skip-commit $(git log -n 1 --format=%H HEAD) \
47+
--repository ${{ github.repository }} \
48+
--commit \
49+
${{ steps.get_old_version.outputs.version }} ${{ steps.get_new_version.outputs.version }}
50+
# We move the tag to after the release notes are updated so that later steps (i.e. sphinx) will pick up the udpated
51+
# release notes
52+
- name: Move tag to HEAD
53+
shell: bash
54+
run: git tag -m "Release ${{ steps.get_new_version.outputs.version }}" -f "${{ steps.get_new_version.outputs.version }}"
55+
56+
# push the changes to gradle.properties, the release notes, and the tag as one operation, so if it fails,
57+
# it will be as if the release never did anything
58+
- name: Push Version Update
59+
shell: bash
60+
run: git push origin HEAD "${{ steps.get_new_version.outputs.version }}"
61+
1962
- name: Run Gradle Test
2063
uses: ./actions/gradle-test
2164
with:
@@ -29,24 +72,16 @@ runs:
2972
ORG_GRADLE_PROJECT_signingPassword: ${{ inputs.gpg_passphrase }}
3073

3174
# Post release: Update various files which reference version
32-
- name: Update release notes
33-
shell: bash
34-
run: ARTIFACT_VERSION="${{ steps.get_version.outputs.version }}" ./build/update_release_notes.bash
75+
# Updating the yaml files has to be done after the tests complete, or it will mark tests as failing that aren't
76+
# supported by the previous version.
3577
- name: Update YAML test file versions
3678
uses: ./actions/run-gradle
3779
with:
3880
gradle_command: updateYamsql -PreleaseBuild=true
3981
- name: Commit YAML updates
4082
shell: bash
41-
run: python ./build/commit_yamsql_updates.py "${{ steps.get_version.outputs.version }}"
83+
run: python ./build/commit_yamsql_updates.py "${{ steps.get_new_version.outputs.version }}"
4284

43-
# Create and push the tag
44-
- name: Create tag
45-
shell: bash
46-
run: git tag -m "Release ${{ steps.get_version.outputs.version }}" -f "${{ steps.get_version.outputs.version }}"
47-
- name: Push tag
48-
shell: bash
49-
run: git push origin "${{ steps.get_version.outputs.version }}"
5085
- name: Push Updates
5186
id: push_updates
5287
shell: bash
@@ -62,12 +97,12 @@ runs:
6297
with:
6398
branch: release-build
6499
branch-suffix: timestamp
65-
title: "Updates for ${{ steps.get_version.outputs.version }} release"
100+
title: "Updates for ${{ steps.get_new_version.outputs.version }} release"
66101
sign-commits: true
67102
body: |
68-
Updates from release for version ${{ steps.get_version.outputs.version }}. Conflicts during the build prevented automatic updating. Please resolve conflicts by checking out the current branch, merging, and then deleting this branch.
103+
Updates from release for version ${{ steps.get_new_version.outputs.version }}. Conflicts during the build prevented automatic updating. Please resolve conflicts by checking out the current branch, merging, and then deleting this branch.
69104
70105
# Creating the PR can change the current branch. Explicitly check out the tag here for downstream builds
71106
- name: Revert to tag
72107
shell: bash
73-
run: git checkout "${{ steps.get_version.outputs.version }}"
108+
run: git checkout "${{ steps.get_new_version.outputs.version }}"

0 commit comments

Comments
 (0)