chore: update release guide and helper script (#1521)

This commit is contained in:
Dmitry Gozman 2020-03-25 13:15:29 -07:00 committed by GitHub
parent ef9e04d399
commit 6ee7852f0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 13 deletions

View File

@ -4,9 +4,9 @@
1. Version starts with "v", e.g. "vX.Y.Z".
1. Fill "Raw notes".
- `git fetch --tags upstream`
- `git log --pretty="%h - %s" v0.11.1..HEAD`
- `git log --pretty="%h - %s" $(git describe --tags --abbrev=0)..HEAD`
1. Fill "Bug fixes".
- `git log v0.11.1..HEAD`
- `git log $(git describe --tags --abbrev=0)..HEAD`
- Manually look for `#1234` references in commit messages.
1. Fill "Current status".
- `node utils/print_versions.js`
@ -14,9 +14,9 @@
1. Fill "Highlights" if any.
- Be creative.
1. Fill "Breaking API Changes" if any.
- `git diff v0.11.1:docs/api.md docs/api.md`
- `git diff $(git describe --tags --abbrev=0):docs/api.md docs/api.md`
1. Fill "New APIs" if any.
- `git diff v0.11.1:docs/api.md docs/api.md`
- `git diff $(git describe --tags --abbrev=0):docs/api.md docs/api.md`
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".
@ -26,8 +26,7 @@
1. Announce `PSA: release vX.Y.Z in progress. Please do not commit anything.`
- **Important**: no other commits should land in-between release commit and bump commit.
1. Mark a new version.
- Bump `package.json` version to `vX.Y.Z`.
- `node utils/sync_package_versions.js && npm run doc`.
- `node utils/update_version.js vX.Y.Z && npm run doc`.
- Send a PR titled `chore: mark version vX.Y.Z`.
- Make sure the PR passes all required checks and merge it.
1. Publish to npm.
@ -35,7 +34,6 @@
- `utils/publish_all_packages.sh --release`
1. Click 'Publish release' button on the prepared release notes.
1. Mark post release.
- Bump `package.json` version to `vX.Y.Z-post`.
- `node utils/sync_package_versions.js && npm run doc`.
- `node utils/update_version.js vX.Y.Z-post && npm run doc`.
- Merge a PR titled `chore: bump version to vX.Y.Z-post`.
1. Announce `PSA: release vX.Y.Z is out.`

View File

@ -35,7 +35,6 @@
"prepare": "node install-from-github.js",
"build": "node utils/runWebpack.js --mode='development' && tsc -p .",
"watch": "node utils/runWebpack.js --mode='development' --watch --silent | tsc -w -p .",
"version": "node utils/sync_package_versions.js && npm run doc",
"test-types": "npm run generate-types && npx -p typescript@3.7.5 tsc -p utils/generate_types/test/tsconfig.json",
"generate-types": "node utils/generate_types/"
},

View File

@ -13,19 +13,32 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const fs = require('fs');
const path = require('path');
const {version} = require('../package.json');
let version = process.argv[2];
if (!version || !version.match(/^v\d+\.\d+\.\d+(-post)?$/)) {
console.error(`Malformed version "${version}"`);
console.error(`Correct examples:`);
console.error(` update_version.js v1.0.0`);
console.error(` update_version.js v1.0.0-post`);
process.exit(1);
}
version = version.substring(1);
updatePackage(path.join(__dirname, '..', 'package.json'), packageJSON => {
packageJSON.version = version;
});
for (const packageName of ['playwright-chromium', 'playwright-firefox', 'playwright-webkit', 'playwright']) {
updatePackage(packageName, packageJSON => {
updatePackage(path.join(__dirname, '..', 'packages', packageName, 'package.json'), packageJSON => {
packageJSON.version = version;
packageJSON.dependencies['playwright-core'] = `=${version}`;
});
}
function updatePackage(packageName, transform) {
const packageJSONPath = path.join(__dirname, '..', 'packages', packageName, 'package.json');
function updatePackage(packageJSONPath, transform) {
console.log(`Updating ${packageJSONPath} to ${version}.`);
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath));
transform(packageJSON);