Skip to content

PatchRight-Python Workflow #1359

PatchRight-Python Workflow

PatchRight-Python Workflow #1359

name: PatchRight-Python Workflow
on:
# enabling manual trigger
workflow_dispatch:
inputs:
version:
description: 'Playwright Version'
default: ''
# running every hour
schedule:
- cron: '48 * * * *'
permissions:
actions: none
attestations: none
checks: none
contents: write
deployments: none
id-token: write # For trusted Publishing
issues: none
discussions: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none
env:
REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
patchright-workflow:
name: "Patchright-Python Workflow: Install, Patch, Build and Publish Patchright Python Package"
runs-on: ubuntu-24.04
environment:
name: pypi
url: https://pypi.org/p/patchright
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Check Release Version
id: version_check
run: |
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: |
git clone https://github.com/microsoft/playwright-python --branch ${{ env.playwright_version }}
cd playwright-python
python -m pip install --upgrade pip
pip install -r local-requirements.txt
pip install -e .
pip install black toml
- name: Patch Playwright-Python Package
if: steps.version_check.outputs.proceed == 'true'
run: |
python patch_python_package.py
python -m black playwright-python
- name: Build Patchright-Python Package
if: steps.version_check.outputs.proceed == 'true'
run: |
cd playwright-python
pip install -e .
for wheel in $(python setup.py --list-wheels); do
PLAYWRIGHT_TARGET_WHEEL=$wheel python -m build --wheel
done
- name: Create Empty Versioning Release
if: steps.version_check.outputs.proceed == 'true'
uses: actions/create-release@v1
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