chore: add script to generate release notes (#2099)
This commit is contained in:
parent
d95891ebad
commit
193924f405
|
|
@ -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. Use ["draft new release tag"](https://github.com/microsoft/playwright/releases/new).
|
||||||
1. Version starts with "v", e.g. "vX.Y.Z".
|
1. Version starts with "v", e.g. "vX.Y.Z".
|
||||||
1. Fill "Browser versions".
|
1. Run `./utils/draft_release_notes.sh` and fill in the "TODO" in generated text.
|
||||||
- `./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. 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.
|
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.
|
- Before publishing, replace `blob/master/docs` with `blob/vX.Y.Z/docs` in all the links.
|
||||||
1. Use "Save Draft", not "Publish".
|
1. Use "Save Draft", not "Publish".
|
||||||
|
|
|
||||||
|
|
@ -73,19 +73,20 @@ function runCommands(sources, {libversion, chromiumVersion, firefoxVersion}) {
|
||||||
function getTOCEntriesForText(text) {
|
function getTOCEntriesForText(text) {
|
||||||
const ids = new Set();
|
const ids = new Set();
|
||||||
const titles = [];
|
const titles = [];
|
||||||
|
const titleRegex = /^(#+)\s+(.*)$/;
|
||||||
let insideCodeBlock = false;
|
let insideCodeBlock = false;
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
text.split('\n').forEach((aLine, lineNumber) => {
|
text.split('\n').forEach((aLine, lineNumber) => {
|
||||||
const line = aLine.trim();
|
const line = aLine.trim();
|
||||||
if (line.startsWith('```'))
|
if (line.startsWith('```'))
|
||||||
insideCodeBlock = !insideCodeBlock;
|
insideCodeBlock = !insideCodeBlock;
|
||||||
else if (!insideCodeBlock && line.startsWith('#'))
|
else if (!insideCodeBlock && line.match(titleRegex))
|
||||||
titles.push({line, offset: offset + lineNumber});
|
titles.push({line, offset: offset + lineNumber});
|
||||||
offset += aLine.length;
|
offset += aLine.length;
|
||||||
});
|
});
|
||||||
let tocEntries = [];
|
let tocEntries = [];
|
||||||
for (const {line, offset} of titles) {
|
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 delinkifiedName = name.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1');
|
||||||
const id = delinkifiedName.trim().toLowerCase().replace(/\s/g, '-').replace(/[^-0-9a-zа-яё]/ig, '');
|
const id = delinkifiedName.trim().toLowerCase().replace(/\s/g, '-').replace(/[^-0-9a-zа-яё]/ig, '');
|
||||||
let dedupId = id;
|
let dedupId = id;
|
||||||
|
|
|
||||||
34
utils/draft_release_notes.sh
Executable file
34
utils/draft_release_notes.sh
Executable 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
|
||||||
|
|
||||||
|
|
@ -21,6 +21,6 @@ const child_process = require('child_process');
|
||||||
for (const browserType of [pw.chromium, pw.firefox]) {
|
for (const browserType of [pw.chromium, pw.firefox]) {
|
||||||
const executablePath = browserType.executablePath();
|
const executablePath = browserType.executablePath();
|
||||||
const version = child_process.execSync(executablePath + ' --version').toString().trim();
|
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');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue