Skip to content

Commit

Permalink
chore: update readme upon api update (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelfeldman committed Nov 18, 2020
1 parent 1467ee5 commit 524fc3e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H

| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->86.0.4238.0<!-- GEN:stop --> ||||
| WebKit 14.0 ||||
| Firefox <!-- GEN:firefox-version -->80.0b8<!-- GEN:stop --> ||||
| Chromium <!-- GEN:chromium-version -->88.0.4324.0<!-- GEN:stop --> ||||
| WebKit <!-- GEN:webkit-version -->14.0<!-- GEN:stop --> ||||
| Firefox <!-- GEN:firefox-version -->83.0<!-- GEN:stop --> ||||

Headless execution is supported for all browsers on all platforms.

Expand Down
2 changes: 2 additions & 0 deletions scripts/update_api.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

python scripts/update_versions.py

function update_api {
echo "Generating $1"
file_name="$1"
Expand Down
15 changes: 15 additions & 0 deletions scripts/update_versions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import re
from playwright import sync_playwright

with sync_playwright() as p:
r = open("README.md", "r")
text = r.read()
for browser_type in [p.chromium, p.firefox, p.webkit]:
rx = re.compile(r"<!-- GEN:" + browser_type.name + r"-version -->([^<]+)<!-- GEN:stop -->")
browser = browser_type.launch()
text = rx.sub(f"<!-- GEN:{browser_type.name}-version -->{browser.version}<!-- GEN:stop -->", text)
browser.close()

w = open("README.md", "w")
w.write(text)
w.close()

0 comments on commit 524fc3e

Please sign in to comment.