Skip to content

Generate release notes automatically from pull requests #3174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 49 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d419c80
Start of script to generate release notes automatically from PRs
ScottDugas Feb 18, 2025
29ca2ad
Support generating release notes for many versions at once
ScottDugas Feb 18, 2025
30a24aa
Reverse release notes when generating multiple versions
ScottDugas Feb 18, 2025
5c69261
Log commit when there's no labels
ScottDugas Feb 18, 2025
fcdfe65
Include the catch all when printing categories
ScottDugas Feb 18, 2025
63747b6
Optionally update our ReleaseNotes.md
ScottDugas Feb 18, 2025
f08b6d1
Remove release notes that will be automatically generated
ScottDugas Feb 18, 2025
e23ebb5
Find by old version rather than placeholder
ScottDugas Feb 18, 2025
6df1e99
Fix heading depth
ScottDugas Feb 18, 2025
7065221
Remove NEXT_MINOR_VERSION placeholder
ScottDugas Feb 18, 2025
7015935
Update release notes inserting versions respecting minor version
ScottDugas Feb 18, 2025
59377c2
Revert release notes to what is in main
ScottDugas Feb 18, 2025
aede97d
Put Build/Test/Documentation improvements in a collapsed section
ScottDugas Feb 18, 2025
31ede36
Cleanup logging when creating release notes
ScottDugas Feb 18, 2025
716d751
Remove unused .github/release.yml
ScottDugas Feb 19, 2025
3fbce56
Use <h4> on label sections
ScottDugas Feb 19, 2025
6699a42
Add blank lines between headers and content
ScottDugas Feb 19, 2025
29ac603
Make the full changelog a proper markdown link
ScottDugas Feb 19, 2025
55eb90c
Present PR and contributor as proper markdown links
ScottDugas Feb 19, 2025
a090ffc
Use .. instead of ... when running git log
ScottDugas Feb 19, 2025
2011fe1
Fix version comparison
ScottDugas Feb 19, 2025
f52b00e
Add an option to commit the release notes after updating
ScottDugas Feb 19, 2025
6bd2d5b
Change release workflow to use new release notes generation script
ScottDugas Feb 19, 2025
74d6795
Update CONTRIBUTING.md to stop people from updating release notes
ScottDugas Feb 19, 2025
9a4dcaf
Cleanup advice for PR titles in CONTRIBUTING.md
ScottDugas Feb 19, 2025
592f246
Add and improve comments in create_release_notes and the release action
ScottDugas Feb 19, 2025
245f1ff
Fix issue with <h4> tags on collapsed categories
ScottDugas Feb 20, 2025
05f70a2
Add old/new versions in "Full Changelog" link
ScottDugas Feb 20, 2025
4f4ece7
Merge branch 'main' into generate-new-release-notes
ScottDugas Feb 20, 2025
37c58af
Remove authors from release notes
ScottDugas Feb 20, 2025
1c38fcb
Fix reference to release notes in release action
ScottDugas Feb 20, 2025
5370e56
Add missing shell input to run commands
ScottDugas Feb 20, 2025
8a5ba60
Use raw string for regex
ScottDugas Feb 20, 2025
16964c7
Add missing backslash to update release notes command
ScottDugas Feb 20, 2025
05edbd1
Fix path to the config for updating release notes
ScottDugas Feb 20, 2025
d4c5f81
Use a "-" before the PR reference, rather than "in"
ScottDugas Feb 20, 2025
5f2e1f3
Fetch all the hisory during release builds
ScottDugas Feb 20, 2025
68ab398
Skip head commit when generating release notes
ScottDugas Feb 20, 2025
622fea3
Get repository from workflow, rather than hardcoding
ScottDugas Feb 20, 2025
0c75513
Mark labels in CONTRIBUTING.md with backticks
ScottDugas Feb 20, 2025
2761e07
Document in CONTRIBUTING.md what happens if a pr has multiple labels
ScottDugas Feb 20, 2025
cec63b7
Remove release notes generated with old process
ScottDugas Feb 20, 2025
149af8c
Updating release notes for 4.1.8.0
ScottDugas Feb 20, 2025
f1bb1ab
Updating release notes for 4.0.559.6
ScottDugas Feb 20, 2025
e4a108d
Have create_release_notes handle not providing skip-commit
ScottDugas Feb 20, 2025
32426db
Add manual documentation to release notes pre 4.1.8.0
ScottDugas Feb 20, 2025
1d145b9
Merge branch 'main' into generate-new-release-notes
ScottDugas Feb 20, 2025
ea6f58e
Cleanup comments as per suggestions
ScottDugas Feb 21, 2025
dc8e30c
Restore results of 4.1.8.0 mixed-mode test run
ScottDugas Feb 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions .github/release.yml

This file was deleted.

13 changes: 5 additions & 8 deletions .github/workflows/patch_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,25 @@ jobs:
with:
ref: ${{ inputs.branch }}
ssh-key: ${{ secrets.DEPLOY_KEY }}
fetch-tags: true
# fetch all the history to make sure that we have the last release
# I tried fetching part of the history, but I just couldn't get it to work, and fetching all still takes like 5s
fetch-depth: 0
- name: Setup Base Environment
uses: ./actions/setup-base-env
- name: Setup FDB
uses: ./actions/setup-fdb

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to try and test the changes to the actions in a separate repository.

# Push a version bump back to main. There are failure scenarios that can result
# in published artifacts but an erroneous build, so it's safer to bump the version
# at the beginning
- name: Configure Git
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be moved into the action, but I didn't want to change more than I had to

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I would have been fine with moving this into the composite step in this PR

run: |
git config --global user.name 'FoundationDB CI'
git config --global user.email '[email protected]'
- name: Increment Version
run: python build/versionutils.py gradle.properties -u PATCH --increment --commit
- name: Push Version Update
run: git push

- name: Build and publish release
uses: ./actions/release-build-publish
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
update_type: PATCH
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,26 @@ jobs:
uses: actions/[email protected]
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
fetch-tags: true
# fetch all the history to make sure that we have the last release
# I tried fetching part of the history, but I just couldn't get it to work, and fetching all still takes like 5s
fetch-depth: 0
- name: Setup Base Environment
id: setup-base
uses: ./actions/setup-base-env
- name: Setup FDB
uses: ./actions/setup-fdb

# Push a version bump back to main. There are failure scenarios that can result
# in published artifacts but an erroneous build, so it's safer to bump the version
# at the beginning
- name: Configure git
run: |
git config --global user.name 'FoundationDB CI'
git config --global user.email '[email protected]'
- name: Increment version
run: python build/versionutils.py gradle.properties --increment --commit
- name: Push version increment
run: git push

- name: Build and publish
uses: ./actions/release-build-publish
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
update_type: BUILD
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
Expand Down
30 changes: 23 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ importantly, it keeps the community open and communicative.

### Opening a Pull Request

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

If your pull request results in a user-visible change to the Record Layer, you should
also update the [release notes](docs/sphinx/source/ReleaseNotes.md). For most changes, it
is sufficient to fill in one of the bullets in the "next release" section of that
document. You should include a short description of the change as well as filling in
the issue number. The "next release" section is commented out, so the change won't
be visible in our documentation until the next time a release is cut.
PRs should have titles that clearly indicate what the change is accomplishing
as we use these to generate release notes. You can glance at
[release notes](docs/sphinx/source/ReleaseNotes.md) for inspiration.

They should also have one of the following labels:
- `breaking change`: For any breaking change
- `enhancement`: For any new feature or enhancement
- `bug fix`: For bug fixes
- `performance`: For performance improvements
- `dependencies`: For updates to dependency versions
- `build improvement`: For updates to our build system that shouldn't have user visible impacts
- `testing improvement`: For new test coverage, or improvements to testing infrastructure
- `documentation`: For improvements to our documentation

(Note: `build improvement`/`testing improvement`/`documentation` are combined in one
grouping in the release notes, that is collapsed).

[release-notes-config.json](build/release-notes-config.json) describes how labels are
converted into categories in the release notes.
If a PR has multiple labels, it will appear in the first grouping as listed above /
in [release-notes-config.json](build/release-notes-config.json) (i.e., if it is has
`enhancement` and `dependencies`, it will only appear under `enhancement`).

### Reporting issues

Expand Down
67 changes: 51 additions & 16 deletions actions/release-build-publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,58 @@ inputs:
gpg_passphrase:
description: 'GPG passphrase for artifact signing'
required: true
update_type:
description: 'One of MAJOR, MINOR, BUILD, PATCH'
required: true

runs:
using: "composite"
steps:
- name: Get version
id: get_version
- name: Get old version
id: get_old_version
shell: bash
run: |
echo "version=$(python build/versionutils.py gradle.properties)" >> "$GITHUB_OUTPUT"
# Push a version bump back to main. There are failure scenarios that can result
# in published artifacts but an erroneous build, so it's safer to bump the version
# at the beginning
- name: Increment version
shell: bash
run: python build/versionutils.py gradle.properties --increment --commit -u ${{ inputs.update_type }}
- name: Get new version
id: get_new_version
shell: bash
run: |
echo "version=$(python build/versionutils.py gradle.properties)" >> "$GITHUB_OUTPUT"
# We also want to push the tag, because that will be used for the next release's release notes
- name: Create tag
shell: bash
run: git tag -m "Release ${{ steps.get_new_version.outputs.version }}" -f "${{ steps.get_new_version.outputs.version }}"

# We want to do this before anything else, because if the later steps fail, we want to make sure that the full
# change log includes all changes, even if they reference a release that was never actually published.
- name: Update release notes
shell: bash
run: |
python ./build/create_release_notes.py \
--config ./build/release-notes-config.json \
--release-notes-md docs/sphinx/source/ReleaseNotes.md \
--skip-commit $(git log -n 1 --format=%H HEAD) \
--repository ${{ github.repository }} \
--commit \
${{ steps.get_old_version.outputs.version }} ${{ steps.get_new_version.outputs.version }}
# We move the tag to after the release notes are updated so that later steps (i.e. sphinx) will pick up the udpated
# release notes
- name: Move tag to HEAD
shell: bash
run: git tag -m "Release ${{ steps.get_new_version.outputs.version }}" -f "${{ steps.get_new_version.outputs.version }}"

# push the changes to gradle.properties, the release notes, and the tag as one operation, so if it fails,
# it will be as if the release never did anything
- name: Push Version Update
shell: bash
run: git push origin HEAD "${{ steps.get_new_version.outputs.version }}"

- name: Run Gradle Test
uses: ./actions/gradle-test
with:
Expand All @@ -29,24 +72,16 @@ runs:
ORG_GRADLE_PROJECT_signingPassword: ${{ inputs.gpg_passphrase }}

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

# Create and push the tag
- name: Create tag
shell: bash
run: git tag -m "Release ${{ steps.get_version.outputs.version }}" -f "${{ steps.get_version.outputs.version }}"
- name: Push tag
shell: bash
run: git push origin "${{ steps.get_version.outputs.version }}"
- name: Push Updates
id: push_updates
shell: bash
Expand All @@ -62,12 +97,12 @@ runs:
with:
branch: release-build
branch-suffix: timestamp
title: "Updates for ${{ steps.get_version.outputs.version }} release"
title: "Updates for ${{ steps.get_new_version.outputs.version }} release"
sign-commits: true
body: |
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.
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.

# Creating the PR can change the current branch. Explicitly check out the tag here for downstream builds
- name: Revert to tag
shell: bash
run: git checkout "${{ steps.get_version.outputs.version }}"
run: git checkout "${{ steps.get_new_version.outputs.version }}"
Loading