Patchright Release Workflow #900
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: Patchright Release Workflow | |
| on: | |
| # enabling manual trigger | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Playwright Version (Base)' | |
| default: '' | |
| patchright_release: | |
| description: 'Patchright Release Version (e.g. `1.55.2`)' | |
| default: '' | |
| # running every hour | |
| schedule: | |
| - cron: '0 * * * *' | |
| env: | |
| REPO: ${{ github.repository }} | |
| jobs: | |
| patchright-release-workflow: | |
| name: "Patchright-Python Workflow: Install, Patch, Build and Publish Patchright Python Package" | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/patchright | |
| permissions: | |
| contents: write | |
| id-token: write # For trusted Publishing | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Set up Python | |
| run: uv python install | |
| - name: Check Release Version | |
| id: version_check | |
| run: | | |
| echo "patchright_release=${{ github.event.inputs.patchright_release }}" >> $GITHUB_ENV | |
| if [ -n "${{ github.event.inputs.version }}" ]; then | |
| echo "proceed=true" >>$GITHUB_OUTPUT | |
| echo "playwright_version=${{ github.event.inputs.version }}" >> $GITHUB_ENV | |
| else | |
| chmod +x utils/release_version_check.sh | |
| utils/release_version_check.sh | |
| fi | |
| - name: Install Playwright-Python Package | |
| if: steps.version_check.outputs.proceed == 'true' | |
| run: | | |
| uv sync --all-groups | |
| git clone https://github.com/microsoft/playwright-python --branch ${{ env.playwright_version }} | |
| uv add -r playwright-python/local-requirements.txt --dev | |
| - name: Patch Playwright-Python Package | |
| if: steps.version_check.outputs.proceed == 'true' | |
| run: | | |
| uv run patch_python_package.py | |
| uvx ruff format playwright-python | |
| - name: Build Patchright-Python Package | |
| if: steps.version_check.outputs.proceed == 'true' | |
| run: | | |
| uv pip install -e playwright-python | |
| cd playwright-python | |
| for wheel in $(uv run setup.py --list-wheels); do | |
| PLAYWRIGHT_TARGET_WHEEL=$wheel uv build --wheel | |
| done | |
| - name: Create Empty Versioning Release | |
| if: steps.version_check.outputs.proceed == 'true' | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ env.playwright_version }} | |
| release_name: ${{ env.playwright_version }} | |
| body: | | |
| This is an automatic deployment in response to a new release of [microsoft/playwright-python](https://github.com/microsoft/playwright-python). | |
| This Release is only used for Versioning. | |
| draft: false | |
| prerelease: false | |
| - name: Publish Patchright-Python Package | |
| if: steps.version_check.outputs.proceed == 'true' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: playwright-python/dist/ | |
| verbose: true |