chore: add script to generate release notes (#2099)

This commit is contained in:
Andrey Lushnikov 2020-05-04 22:28:09 -07:00 committed by GitHub
parent d95891ebad
commit 193924f405
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 19 deletions

View File

@ -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".

View File

@ -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;

34
utils/draft_release_notes.sh Executable file
View File

@ -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

View File

@ -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');