Skip to content

Commit f6003ac

Browse files
authored
Github Workflow Changes for Release Note Process (#4961)
This PR Adds functionality to our github repository for ensuring Release Note process is respected.
1 parent ddd5ccf commit f6003ac

File tree

9 files changed

+268
-91
lines changed

9 files changed

+268
-91
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
*List which issues are fixed by this PR. You must list at least one issue.*
44

5+
<!-- Uncomment and modify the following section if your PR does not require changes to the release notes -->
6+
<!--
7+
RELEASE_NOTE_EXCEPTION=[REASON GOES HERE]
8+
-->
9+
510
## Pre-launch Checklist
611

712
- [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Release Notes
2+
3+
on:
4+
pull_request:
5+
types: [ assigned, opened, synchronize, reopened, edited ]
6+
env:
7+
CURRENT_RELEASE_JSON_FILE_PATH: tool/release_notes/NEXT_RELEASE_NOTES.md
8+
jobs:
9+
release-preparedness:
10+
runs-on: ubuntu-latest
11+
name: Verify PR Release Note Requirements
12+
steps:
13+
14+
- name: Get Pull Request Number
15+
id: get-pull-request-number
16+
run: |
17+
PULL_REQUEST_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
18+
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> $GITHUB_OUTPUT
19+
20+
- name: Check if we have modified release note file
21+
id: get-modified-files
22+
env:
23+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
PULL_NUMBER: ${{steps.get-pull-request-number.outputs.PULL_REQUEST_NUMBER}}
25+
run: |
26+
FILES_RESPONSE=$(gh api /repos/$GITHUB_REPOSITORY/pulls/$PULL_NUMBER/files)
27+
echo "FILES_RESPONSE: $FILES_RESPONSE"
28+
29+
HAS_CHANGED_RELEASE_NOTES=$(echo $FILES_RESPONSE | jq '.[].filename' | jq -s '. | any(. == env.CURRENT_RELEASE_JSON_FILE_PATH)')
30+
echo "HAS_CHANGED_RELEASE_NOTES=$HAS_CHANGED_RELEASE_NOTES" >> $GITHUB_OUTPUT
31+
32+
- name: Get PR Description
33+
id: check-release-note-exceptions
34+
env:
35+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
PULL_NUMBER: ${{steps.get-pull-request-number.outputs.PULL_REQUEST_NUMBER}}
37+
run: |
38+
PULLS_RESPONSE=$(gh api /repos/$GITHUB_REPOSITORY/pulls/$PULL_NUMBER)
39+
DESCRIPTION_BODY=$(echo $PULLS_RESPONSE | jq '.body')
40+
echo $DESCRIPTION_BODY
41+
if $(echo $DESCRIPTION_BODY | grep -Eq "RELEASE_NOTE_EXCEPTION="); then
42+
HAS_RELEASE_NOTE_EXCEPTION_STRING=true
43+
else
44+
HAS_RELEASE_NOTE_EXCEPTION_STRING=false
45+
fi
46+
echo "HAS_RELEASE_NOTE_EXCEPTION_STRING=$HAS_RELEASE_NOTE_EXCEPTION_STRING" >> $GITHUB_OUTPUT
47+
48+
- name: Check Release Preparedness requirements
49+
env:
50+
HAS_CHANGED_RELEASE_NOTES: ${{steps.get-modified-files.outputs.HAS_CHANGED_RELEASE_NOTES}}
51+
HAS_RELEASE_NOTE_EXCEPTION_STRING: ${{steps.check-release-note-exceptions.outputs.HAS_RELEASE_NOTE_EXCEPTION_STRING}}
52+
run: |
53+
if [ "$HAS_CHANGED_RELEASE_NOTES" != "true" ] && [ "$HAS_RELEASE_NOTE_EXCEPTION_STRING" != "true" ] ; then
54+
echo "Release Preparedness check failed"
55+
echo "::error file=$CURRENT_RELEASE_JSON_FILE_PATH,line=0,col=0,endColumn=0,title='Release Notes Weren\'t Modified'::Please add a release note entry or an exception reason to your description using: \`RELEASE_NOTE_EXCEPTION=[reason goes here]\`"
56+
exit 1
57+
fi

packages/devtools_app/lib/src/framework/release_notes/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
## Writing DevTools release notes
1+
## Generating Release notes
22
- Release notes for DevTools are hosted on the flutter website (see [archive](https://docs.flutter.dev/development/tools/devtools/release-notes)).
3-
- To add release notes for the latest release, create a PR with the appropriate changes for your release
4-
- The [release notes template](release-notes-template.md) can be used as a starting point
5-
- see example [PR](https://github.com/flutter/website/pull/6791).
6-
3+
- To add release notes for the latest release, create a PR with the appropriate changes for your release.
4+
- The [NEXT_RELEASE_NOTES.md](../../../../../../tool/release_notes/NEXT_RELEASE_NOTES.md) file contains the running release notes for the current version.
5+
- see example [PR](https://github.com/flutter/website/pull/6791) for an idea of how to add those to the Flutter website.
76
- Test these changes locally before creating the PR.
87
- See [README.md](https://github.com/flutter/website/blob/main/README.md)
98
for getting setup to run the Flutter website locally.

tool/README.md

Lines changed: 61 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -19,87 +19,41 @@ Make sure:
1919

2020
### Prepare the release
2121

22-
#### Create a branch for your release.
23-
24-
```shell
25-
cd ~/path/to/devtools
26-
```
27-
28-
```shell
29-
git checkout master && \
30-
git pull upstream master && \
31-
git checkout -b release_$(date +%s);
32-
```
3322

3423
#### Update the DevTools version number
3524

36-
Run the `tool/update_version.dart` script to update the DevTools version.
37-
- For regular monthly releases, use `minor`:
38-
```shell
39-
dart tool/update_version.dart auto --type minor
40-
```
41-
- To manually set the version:
42-
```shell
43-
dart tool/update_version.dart manual --new-version 1.2.3
44-
```
45-
- To automatically update the version by `major`, `minor`, `patch`, or `dev`:
46-
```shell
47-
dart tool/update_version.dart auto --type patch
48-
```
49-
- Pre-release versions can be stripped with:
50-
```shell
51-
dart tool/update_version.dart auto --type release
52-
```
53-
54-
Verify:
55-
* that this script updated the pubspecs under packages/
56-
* updated all references to those packages.
57-
* make sure that the version constant in `packages/devtools_app/lib/devtools.dart` was updated
25+
- Make sure your working branch is clean
26+
- Run the `tool/release_helper.sh` script with `minor` or `major`.
27+
`./tool/release_helper.sh [minor|major]`
28+
- This creates 2 branches for you:
29+
- Release Branch
30+
- Next Branch
31+
- The following steps will guide you through how these branches will be prepared and merged.
32+
- **For your convenience, the `tool/release_helper.sh` script exports the following two variables to the terminal it is run in:**
33+
- `$DEVTOOLS_RELEASE_BRANCH`
34+
- `$DEVTOOLS_NEXT_BRANCH`
35+
36+
#### Verify the version changes
37+
> For both the `$DEVTOOLS_RELEASE_BRANCH` and the `$DEVTOOLS_NEXT_BRANCH` branches
38+
39+
Verify the version changes:
40+
- that release_helper.sh script updated the pubspecs under packages/
41+
- updated all references to those packages.
42+
- make sure that the version constant in `packages/devtools_app/lib/devtools.dart` was updated
5843

5944
These packages always have their version numbers updated in lock, so we don't have to worry about versioning.
6045

61-
> Note: Updating to a new `dev` version will automatically prepare the version for a new `minor` release (eg, `2.17.0` will become `2.18.0-dev.0`). To update to a `major` or `patch` release instead, specify either `dev,patch` or `dev,major` (eg, `dart tool/update_version.dart auto --type dev,patch`).
62-
63-
#### Update the CHANGELOG.md (for non-dev releases)
64-
65-
* Use the tool `generate-changelog` to automatically update the `packages/devtools/CHANGELOG.md` file.
46+
#### Manually review the CHANGELOG.md
47+
> For both the `$DEVTOOLS_RELEASE_BRANCH` and the `$DEVTOOLS_NEXT_BRANCH` branches
6648
67-
```shell
68-
cd ~/path/to/devtools && \
69-
dart tool/bin/repo_tool.dart generate-changelog;
70-
```
71-
72-
* The `generate-changelog` script is
73-
intended to do the bulk of the work, but still needs manual review.
7449
* Verify
7550
* that the version for the CHANGELOG entry was correctly generated
7651
* that the entries don't have any syntax errors.
7752

78-
#### Push the local branch
79-
80-
```shell
81-
NEW_DEVTOOLS_VERSION=2.7.0 # Change this to the new version
82-
```
83-
84-
```shell
85-
git add . && \
86-
git commit -m "Prepare for $NEW_DEVTOOLS_VERSION release." && \
87-
git push origin release_$NEW_DEVTOOLS_VERSION;
88-
```
89-
90-
From the git GUI tool or from github.com directly:
91-
1. Create a PR.
92-
2. Add the entry about the created PR to the CHANGELOG.md manually, and push to the PR.
93-
3. Receive an LGTM, squash and commit.
94-
95-
### Test the release
96-
97-
- Checkout the commit you just created,
98-
- or remain on the branch you just landed the prep PR from.
99-
```shell
100-
git checkout 8881a7caa9067471008a8e00750b161f53cdb843
101-
```
53+
### Test the CLEAN_BRANCH
54+
> You only need to do this on the `$DEVTOOLS_RELEASE_BRANCH` branch
10255
56+
- Checkout the `$DEVTOOLS_RELEASE_BRANCH`,
10357
- Build the DevTools binary and run it from your local Dart SDK.
10458
- From the main devtools/ directory.
10559
```shell
@@ -126,6 +80,20 @@ From the git GUI tool or from github.com directly:
12680
git checkout . && \
12781
git clean -f -d;
12882
```
83+
#### Push the `$DEVTOOLS_RELEASE_BRANCH`
84+
85+
86+
> Ensure you are still on the `$DEVTOOLS_RELEASE_BRANCH`
87+
88+
```shell
89+
git push -u origin $DEVTOOLS_RELEASE_BRANCH
90+
```
91+
92+
From the git GUI tool or from github.com directly:
93+
1. Create a PR.
94+
2. Add the entry about the created PR to the CHANGELOG.md manually, and push to the PR.
95+
3. Receive an LGTM, squash and commit.
96+
12997

13098
### Tag the release
13199
- Checkout the commit from which you want to release DevTools
@@ -139,6 +107,22 @@ From the git GUI tool or from github.com directly:
139107
tool/tag_version.sh;
140108
```
141109

110+
### Verify and Submit the release notes
111+
112+
See the release notes
113+
[README.md](https://github.com/flutter/devtools/blob/master/packages/devtools_app/lib/src/framework/release_notes/README.md)
114+
for details on where to add DevTools release notes to Flutter website and how to test them.
115+
116+
- Follow the release notes
117+
[README.md](https://github.com/flutter/devtools/blob/master/packages/devtools_app/lib/src/framework/release_notes/README.md)
118+
to add release notes to Flutter website
119+
- On the `$DEVTOOLS_RELEASE_BRANCH` copy the release notes from [NEXT_RELEASE_NOTES.md](./release_notes/NEXT_RELEASE_NOTES.md)
120+
- These are the release notes you will submit through the flutter/website PR.
121+
- make sure to also follow the instructions to test them.
122+
123+
124+
[1]: ../packages/devtools_app/lib/src/framework/release_notes/release-notes-next.md
125+
142126
### Upload the DevTools binary to CIPD
143127
- Use the update.sh script to build and upload the DevTools binary to CIPD:
144128
```shell
@@ -202,19 +186,12 @@ From the git GUI tool or from github.com directly:
202186
flutter pub publish
203187
```
204188
205-
### Write release notes for the release
206-
Release notes should contain details about the user-facing changes included in the release.
207-
208-
These notes are shown directly in DevTools when a user opens a new version of DevTools.
209-
210-
1. Request the team to verify their important user facing changes are documented in
211-
[release-notes-next.md][1].
212-
213-
2. See the release notes
214-
[README.md](https://github.com/flutter/devtools/blob/master/packages/devtools_app/lib/src/framework/release_notes/README.md)
215-
for details on where to add DevTools release notes to Flutter website and how to test them.
216-
217-
3. Copy the content of [release-notes-template.md](../packages/devtools_app/lib/src/framework/release_notes/release-notes-template.md) to [release-notes-next.md][1], to contain
218-
draft for the next release.
189+
### Push the DEVTOOLS_NEXT_BRANCH
190+
```shell
191+
git checkout $DEVTOOLS_NEXT_BRANCH
192+
git push -u origin $DEVTOOLS_NEXT_BRANCH
193+
```
219194
220-
[1]: ../packages/devtools_app/lib/src/framework/release_notes/release-notes-next.md
195+
From the git GUI tool or from github.com directly:
196+
1. Create a PR.
197+
2. Receive an LGTM, squash and commit.

tool/release_helper.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash -ex
2+
3+
DEVTOOLS_REMOTE=$(git remote -v | grep "flutter/devtools.git" | grep "(fetch)"| tail -n1 | cut -w -f1)
4+
TYPE=$1
5+
6+
if [ -z "$TYPE" ] ; then
7+
echo "$0 expects a type as a first parameter"
8+
exit 1
9+
fi
10+
11+
if [ -z "$DEVTOOLS_REMOTE" ] ; then
12+
echo "Couldn't find a remote that points to flutter/devtools.git"
13+
exit 1
14+
fi
15+
16+
STATUS=$(git status -s)
17+
if [[ ! -z "$STATUS" ]] ; then
18+
echo "Make sure your working directory is clean before running the helper"
19+
exit 1
20+
fi
21+
22+
MASTER="tmp_master_$(date +%s)"
23+
git fetch $DEVTOOLS_REMOTE master
24+
git checkout -b $MASTER $DEVTOOLS_REMOTE/master
25+
26+
27+
RELEASE_BRANCH="clean_release_$(date +%s)"
28+
NEXT_BRANCH="next_version_$(date +%s)"
29+
30+
git checkout -b $RELEASE_BRANCH;
31+
COMMIT_MESSAGE=$(dart tool/update_version.dart auto -d -t release)
32+
dart tool/update_version.dart auto -t release
33+
dart tool/bin/repo_tool.dart generate-changelog
34+
git commit -am "$COMMIT_MESSAGE"
35+
36+
git checkout -b $NEXT_BRANCH;
37+
TYPE_BUMP_COMMIT_MESSAGE=$(dart tool/update_version.dart auto -d -t $TYPE)
38+
dart tool/update_version.dart auto -t $TYPE
39+
git commit -am "$TYPE_BUMP_COMMIT_MESSAGE"
40+
41+
DEV_BUMP_COMMIT_MESSAGE=$(dart tool/update_version.dart auto -d -t dev)
42+
dart tool/update_version.dart auto -t dev # set the first dev version
43+
git commit -am "$DEV_BUMP_COMMIT_MESSAGE"
44+
45+
46+
git checkout $RELEASE_BRANCH
47+
48+
echo "------------------------"
49+
echo "RELEASE HELPER FINISHED"
50+
echo "The branches created are as follows:"
51+
echo
52+
echo "DEVTOOLS_RELEASE_BRANCH=\"$RELEASE_BRANCH\";"
53+
echo "DEVTOOLS_NEXT_BRANCH=\"$NEXT_BRANCH\";"
54+
55+
export DEVTOOLS_RELEASE_BRANCH="$RELEASE_BRANCH"
56+
export DEVTOOLS_NEXT_BRANCH="$NEXT_BRANCH"
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
This is draft for future release notes, that are going to land on
2+
[the Flutter website](https://docs.flutter.dev/development/tools/devtools/release-notes).
3+
4+
# DevTools 2.21.0 release notes
5+
6+
Dart & Flutter DevTools - A Suite of Performance Tools for Dart and Flutter
7+
8+
## General updates
9+
TODO: Remove this section if there are not any general updates.
10+
11+
## Inspector updates
12+
TODO: Remove this section if there are not any general updates.
13+
14+
## Performance updates
15+
TODO: Remove this section if there are not any general updates.
16+
17+
## CPU profiler updates
18+
TODO: Remove this section if there are not any general updates.
19+
20+
## Memory updates
21+
TODO: Remove this section if there are not any general updates.
22+
23+
## Debugger updates
24+
TODO: Remove this section if there are not any general updates.
25+
26+
## Network profiler updates
27+
TODO: Remove this section if there are not any general updates.
28+
29+
## Logging updates
30+
TODO: Remove this section if there are not any general updates.
31+
32+
## App size tool updates
33+
TODO: Remove this section if there are not any general updates.
34+
35+
## Changelog
36+
More details about changes and fixes are available in the DevTools
37+
[changelog](https://github.com/flutter/devtools/blob/master/CHANGELOG.md).
File renamed without changes.

tool/release_notes/images/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)