Skip to content

Commit

Permalink
chore: add script to generate release notes (#2099)
Browse files Browse the repository at this point in the history
  • Loading branch information
aslushnikov committed May 5, 2020
1 parent d95891e commit 193924f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 19 deletions.
16 changes: 1 addition & 15 deletions docs/development/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,7 @@ Once release branch is pushed, it's last commit will be picked up by our CI/CD:

1. Use ["draft new release tag"](https://github.com/microsoft/playwright/releases/new).
1. Version starts with "v", e.g. "vX.Y.Z".
1. Fill "Browser versions".
- `./utils/print_versions.js`
1. Fill "Highlights" if any.
- Be creative.
1. Make sure you fetched tags from the upstream to get latest releases.
- `git fetch --tags upstream`
1. Fill "New APIs" if any.
- `git diff $(git describe --tags $(git rev-list --tags --max-count=1)):docs/api.md docs/api.md`
1. Fill "Breaking API Changes" if any.
- `git diff $(git describe --tags $(git rev-list --tags --max-count=1)):docs/api.md docs/api.md`
1. Fill "Bug fixes".
- `./utils/list_closed_issues.sh $(git describe --tags $(git rev-list --tags --max-count=1))`
1. Fill "Raw notes".
- `git log --pretty="%h - %s" $(git describe --tags $(git rev-list --tags --max-count=1))..HEAD`

1. Run `./utils/draft_release_notes.sh` and fill in the "TODO" in generated text.
1. When making links to the API, copy actual links from [GitHub](https://github.com/microsoft/playwright/blob/master/docs/api.md), and not from `api.md` source - these might be incorrect.
- Before publishing, replace `blob/master/docs` with `blob/vX.Y.Z/docs` in all the links.
1. Use "Save Draft", not "Publish".
Expand Down
5 changes: 3 additions & 2 deletions utils/doclint/preprocessor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,20 @@ function runCommands(sources, {libversion, chromiumVersion, firefoxVersion}) {
function getTOCEntriesForText(text) {
const ids = new Set();
const titles = [];
const titleRegex = /^(#+)\s+(.*)$/;
let insideCodeBlock = false;
let offset = 0;
text.split('\n').forEach((aLine, lineNumber) => {
const line = aLine.trim();
if (line.startsWith('```'))
insideCodeBlock = !insideCodeBlock;
else if (!insideCodeBlock && line.startsWith('#'))
else if (!insideCodeBlock && line.match(titleRegex))
titles.push({line, offset: offset + lineNumber});
offset += aLine.length;
});
let tocEntries = [];
for (const {line, offset} of titles) {
const [, nesting, name] = line.match(/^(#+)\s+(.*)$/);
const [, nesting, name] = line.match(titleRegex);
const delinkifiedName = name.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1');
const id = delinkifiedName.trim().toLowerCase().replace(/\s/g, '-').replace(/[^-0-9a-zа-яё]/ig, '');
let dedupId = id;
Expand Down
34 changes: 34 additions & 0 deletions utils/draft_release_notes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -e
set +x

trap "cd $(pwd -P)" EXIT
cd "$(dirname $0)"

git fetch --tags git@github.com:microsoft/playwright.git >/dev/null 2>/dev/null
LAST_RELEASE=$(git describe --tags $(git rev-list --tags --max-count=1))

echo "## Browser Versions"
echo
node ./print_versions.js
echo
echo "## Highlights"
echo
echo "TODO: \`git diff ${LAST_RELEASE}:docs/api.md docs/api.md\`"
echo
echo "## Breaking API Changes"
echo
echo "TODO: \`git diff ${LAST_RELEASE}:docs/api.md docs/api.md\`"
echo
echo "## New APIs"
echo
echo "TODO: \`git diff ${LAST_RELEASE}:docs/api.md docs/api.md\`"
echo
echo "## Bug Fixes"
echo
./list_closed_issues.sh "${LAST_RELEASE}"
echo
echo "## Raw Notes"
echo
git log --pretty="%h - %s" "${LAST_RELEASE}"..HEAD

4 changes: 2 additions & 2 deletions utils/print_versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ const child_process = require('child_process');
for (const browserType of [pw.chromium, pw.firefox]) {
const executablePath = browserType.executablePath();
const version = child_process.execSync(executablePath + ' --version').toString().trim();
console.log(version);
console.log('- ' + version);
}
console.log('WebKit 13.0.4');
console.log('- WebKit 13.0.4');

0 comments on commit 193924f

Please sign in to comment.