Build and Release Patched Patchright #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release Patched Patchright | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| playwright_version: | |
| description: 'Playwright-Python version tag (e.g. v1.56.0)' | |
| required: true | |
| default: 'v1.56.0' | |
| patchright_release: | |
| description: 'Patchright release version (e.g. 1.56.0)' | |
| required: true | |
| default: '1.56.0' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-wheels: | |
| name: Build wheels | |
| runs-on: ubuntu-latest | |
| env: | |
| patchright_release: ${{ github.event.inputs.patchright_release }} | |
| playwright_version: ${{ github.event.inputs.playwright_version }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Set up Python | |
| run: uv python install 3.11 | |
| - name: Install dependencies | |
| run: | | |
| uv sync --all-groups | |
| git clone https://github.com/microsoft/playwright-python --branch "$playwright_version" | |
| uv add -r playwright-python/local-requirements.txt --dev | |
| - name: Patch Playwright-Python Package | |
| run: uv run patch_python_package.py | |
| - name: Format patched code | |
| run: uvx ruff format playwright-python || true | |
| - name: Build wheels | |
| run: | | |
| cd playwright-python | |
| uv pip install -e . | |
| for wheel in $(uv run setup.py --list-wheels); do | |
| PLAYWRIGHT_TARGET_WHEEL=$wheel uv build --wheel | |
| done | |
| - name: Upload wheel artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels | |
| path: playwright-python/dist/*.whl | |
| release: | |
| name: Create GitHub Release | |
| needs: build-wheels | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download wheel artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wheels | |
| path: dist/ | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ github.event.inputs.patchright_release }} | |
| name: patchright v${{ github.event.inputs.patchright_release }} | |
| body: | | |
| Custom patchright build based on playwright-python ${{ github.event.inputs.playwright_version }}. | |
| The networkidle captcha/analytics/heartbeat exclusion is applied at the | |
| **driver level** (ts-morph `framesPatch.ts`) in the bugbasesecurity | |
| patchright driver fork, which this package downloads instead of the | |
| upstream driver. No post-extraction JS patching in this package. | |
| Driver: https://github.com/bugbasesecurity/patchright/releases/tag/v${{ github.event.inputs.patchright_release }} | |
| Install: `pip install patchright@https://github.com/bugbasesecurity/patchright-python/releases/download/v${{ github.event.inputs.patchright_release }}/patchright-${{ github.event.inputs.patchright_release }}-py3-none-manylinux1_x86_64.whl` | |
| files: dist/*.whl | |
| draft: false | |
| prerelease: false |