55 workflow_dispatch :
66 inputs :
77 version :
8- description : ' Playwright Version (Base )'
8+ description : ' Playwright Version (e.g. v1.58.0 or 1.58.0 )'
99 default : ' '
1010 patchright_release :
11- description : ' Patchright Release Version (e.g. `1.55.2`) '
11+ description : ' Patchright Release Version (e.g. v1.58.0 or 1.58.0) on pypi '
1212 default : ' '
1313 # running every hour
1414 schedule :
1515 - cron : ' 0 * * * *'
1616
1717env :
1818 REPO : ${{ github.repository }}
19+ patchright_release : ${{ github.event.inputs.patchright_release || '' }}
1920
2021jobs :
21- patchright -release-workflow :
22- name : " Patchright-Python Workflow: Install, Patch, Build and Publish Patchright Python Package "
22+ check -release-version :
23+ name : Check Release Version
2324 runs-on : ubuntu-latest
24- environment :
25- name : pypi
26- url : https://pypi.org/p/patchright
27- permissions :
28- contents : write
29- id-token : write # For trusted Publishing
25+ outputs :
26+ proceed : ${{ steps.version_check.outputs.proceed }}
27+ playwright_version : ${{ steps.version_check.outputs.playwright_version }}
3028 steps :
3129 - name : Checkout Repository
3230 uses : actions/checkout@v6
3331
34- - name : Install uv
35- uses : astral-sh/setup-uv@v7
36-
37- - name : Set up Python
38- run : uv python install
39-
4032 - name : Check Release Version
4133 id : version_check
4234 run : |
43- echo "patchright_release=${{ github.event.inputs.patchright_release }}" >> $GITHUB_ENV
4435 PLAYWRIGHT_VERSION=""
4536 if [ -n "${{ github.event.inputs.version }}" ]; then
46- PLAYWRIGHT_VERSION="${{ github.event.inputs.version }}"
37+ raw_version="${{ github.event.inputs.version }}"
38+ PLAYWRIGHT_VERSION="v${raw_version#v}"
39+ echo "proceed=true" >>$GITHUB_OUTPUT
40+ echo "playwright_version=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
41+ if [ -n "${{ github.event.inputs.patchright_release }}" ]; then
42+ raw_patchright_release="${{ github.event.inputs.patchright_release }}"
43+ echo "patchright_release=${raw_patchright_release#v}" >> $GITHUB_ENV
44+ fi
45+ elif [ -n "${{ github.event.inputs.patchright_release }}" ]; then
46+ raw_patchright_release="${{ github.event.inputs.patchright_release }}"
47+ echo "patchright_release=${raw_patchright_release#v}" >> $GITHUB_ENV
48+ response=$(curl --silent "https://api.github.com/repos/microsoft/playwright-python/releases/latest")
49+ PLAYWRIGHT_VERSION=$(echo "$response" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
4750 echo "proceed=true" >>$GITHUB_OUTPUT
4851 echo "playwright_version=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
4952 else
@@ -55,12 +58,41 @@ jobs:
5558 echo "playwright_version=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT
5659 fi
5760
61+ run-patchright-tests :
62+ name : Run Patchright Tests
63+ needs : check-release-version
64+ if : needs.check-release-version.outputs.proceed == 'true'
65+ uses : ./.github/workflows/patchright_tests.yml
66+ with :
67+ playwright_version : ${{ needs.check-release-version.outputs.playwright_version }}
68+
69+ patchright-release-workflow :
70+ name : " Patchright-Python Workflow: Install, Patch, Build and Publish Patchright Python Package"
71+ needs : [check-release-version, run-patchright-tests]
72+ runs-on : ubuntu-latest
73+ environment :
74+ name : pypi
75+ url : https://pypi.org/p/patchright
76+ permissions :
77+ contents : write
78+ id-token : write # For trusted Publishing
79+ steps :
80+ - name : Checkout Repository
81+ uses : actions/checkout@v6
82+
83+ - name : Install uv
84+ uses : astral-sh/setup-uv@v7
85+
86+ - name : Set up Python
87+ run : uv python install
88+
5889 - name : Install Playwright-Python Package
59- if : steps.version_check.outputs.proceed == 'true'
90+ env :
91+ playwright_version : ${{ needs.check-release-version.outputs.playwright_version }}
6092 run : |
6193 uv sync --all-groups
6294 if [ -n "$patchright_release" ]; then
63- PATCHRIGHT_RELEASE="$patchright_release"
95+ PATCHRIGHT_RELEASE="${ patchright_release#v} "
6496 else
6597 PLAYWRIGHT_MINOR=${playwright_version#v}
6698 PLAYWRIGHT_MINOR=${PLAYWRIGHT_MINOR%.*}
@@ -72,13 +104,11 @@ jobs:
72104 uv add -r playwright-python/local-requirements.txt --dev
73105
74106 - name : Patch Playwright-Python Package
75- if : steps.version_check.outputs.proceed == 'true'
76107 run : |
77108 uv run patch_python_package.py
78109 uvx ruff format playwright-python
79110
80111 - name : Build Patchright-Python Package
81- if : steps.version_check.outputs.proceed == 'true'
82112 run : |
83113 cd playwright-python
84114 uv pip install -e .
@@ -87,21 +117,19 @@ jobs:
87117 done
88118
89119 - name : Create Empty Versioning Release
90- if : steps.version_check.outputs.proceed == 'true'
91120 uses : actions/create-release@v1
92121 env :
93122 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
94123 with :
95- tag_name : ${{ steps.version_check .outputs.playwright_version }}
96- release_name : ${{ steps.version_check .outputs.playwright_version }}
124+ tag_name : ${{ needs.check-release-version .outputs.playwright_version }}
125+ release_name : ${{ needs.check-release-version .outputs.playwright_version }}
97126 body : |
98127 This is an automatic deployment in response to a new release of [microsoft/playwright-python](https://github.com/microsoft/playwright-python).
99128 This Release is only used for Versioning.
100129 draft : false
101130 prerelease : false
102131
103132 - name : Publish Patchright-Python Package
104- if : steps.version_check.outputs.proceed == 'true'
105133 uses : pypa/gh-action-pypi-publish@release/v1
106134 with :
107135 packages-dir : playwright-python/dist/
0 commit comments