Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

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

Dmitry Gozman6ee7852f0f98
diff --git a/docs/development/releasing.md b/docs/development/releasing.md
index 324ceb9206..0c9aa3f8b3 100644
--- a/docs/development/releasing.md
+++ b/docs/development/releasing.md
@@ -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.`
diff --git a/package.json b/package.json
index 15ca774c41..0a8d6589da 100644
--- a/package.json
+++ b/package.json
@@ -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 [email protected] tsc -p utils/generate_types/test/tsconfig.json",
"generate-types": "node utils/generate_types/"
},
diff --git a/utils/sync_package_versions.js b/utils/update_version.js
similarity index 64%
rename from utils/sync_package_versions.js
rename to utils/update_version.js
index 54954b2d69..d7c6b22125 100644
--- a/utils/sync_package_versions.js
+++ b/utils/update_version.js
@@ -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);