From 193924f405a3173c8ff124253f9e1bd43dc1b115 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Mon, 4 May 2020 22:28:09 -0700 Subject: [PATCH] chore: add script to generate release notes (#2099) --- docs/development/releasing.md | 16 +------------- utils/doclint/preprocessor/index.js | 5 +++-- utils/draft_release_notes.sh | 34 +++++++++++++++++++++++++++++ utils/print_versions.js | 4 ++-- 4 files changed, 40 insertions(+), 19 deletions(-) create mode 100755 utils/draft_release_notes.sh diff --git a/docs/development/releasing.md b/docs/development/releasing.md index 8adf7fcfad8fe..5c1a66bdd548f 100644 --- a/docs/development/releasing.md +++ b/docs/development/releasing.md @@ -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". diff --git a/utils/doclint/preprocessor/index.js b/utils/doclint/preprocessor/index.js index 3e7bf63e679ee..5b9bc2ad82549 100644 --- a/utils/doclint/preprocessor/index.js +++ b/utils/doclint/preprocessor/index.js @@ -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; diff --git a/utils/draft_release_notes.sh b/utils/draft_release_notes.sh new file mode 100755 index 0000000000000..65694476d823e --- /dev/null +++ b/utils/draft_release_notes.sh @@ -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 + diff --git a/utils/print_versions.js b/utils/print_versions.js index b170a49ef2a83..588283b20fa8f 100755 --- a/utils/print_versions.js +++ b/utils/print_versions.js @@ -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');