|
| 1 | +name: PatchRight-Python Workflow |
| 2 | + |
| 3 | +on: |
| 4 | + # enabling manual trigger |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + version: |
| 8 | + description: 'Playwright Version' |
| 9 | + default: '' |
| 10 | + # running every hour |
| 11 | + schedule: |
| 12 | + - cron: '48 * * * *' |
| 13 | + |
| 14 | + |
| 15 | +permissions: |
| 16 | + actions: none |
| 17 | + attestations: none |
| 18 | + checks: none |
| 19 | + contents: write |
| 20 | + deployments: none |
| 21 | + id-token: write # For trusted Publishing |
| 22 | + issues: none |
| 23 | + discussions: none |
| 24 | + packages: none |
| 25 | + pages: none |
| 26 | + pull-requests: none |
| 27 | + repository-projects: none |
| 28 | + security-events: none |
| 29 | + statuses: none |
| 30 | + |
| 31 | + |
| 32 | +env: |
| 33 | + REPO: ${{ github.repository }} |
| 34 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + |
| 36 | +jobs: |
| 37 | + patchright-workflow: |
| 38 | + name: "Patchright-Python Workflow: Install, Patch, Build and Publish Patchright Python Package" |
| 39 | + runs-on: ubuntu-24.04 |
| 40 | + environment: |
| 41 | + name: pypi |
| 42 | + url: https://pypi.org/p/patchright |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v4 |
| 45 | + - name: Set up Python 3.11 |
| 46 | + uses: actions/setup-python@v4 |
| 47 | + with: |
| 48 | + python-version: '3.11' |
| 49 | + |
| 50 | + - name: Check Release Version |
| 51 | + id: version_check |
| 52 | + run: | |
| 53 | + if [ -n "${{ github.event.inputs.version }}" ]; then |
| 54 | + echo "proceed=true" >>$GITHUB_OUTPUT |
| 55 | + echo "playwright_version=${{ github.event.inputs.version }}" >> $GITHUB_ENV |
| 56 | + else |
| 57 | + chmod +x utils/release_version_check.sh |
| 58 | + utils/release_version_check.sh |
| 59 | + fi |
| 60 | +
|
| 61 | + - name: Install Playwright-Python Package |
| 62 | + if: steps.version_check.outputs.proceed == 'true' |
| 63 | + run: | |
| 64 | + git clone https://github.com/microsoft/playwright-python --branch ${{ env.playwright_version }} |
| 65 | + cd playwright-python |
| 66 | + python -m pip install --upgrade pip |
| 67 | + pip install -r local-requirements.txt |
| 68 | + pip install -e . |
| 69 | + pip install black |
| 70 | +
|
| 71 | + - name: Patch Playwright-Python Package |
| 72 | + if: steps.version_check.outputs.proceed == 'true' |
| 73 | + run: | |
| 74 | + python patch_python_package.py |
| 75 | + python -m black playwright-python |
| 76 | +
|
| 77 | + - name: Build Patchright-Python Package |
| 78 | + if: steps.version_check.outputs.proceed == 'true' |
| 79 | + run: | |
| 80 | + cd playwright-python |
| 81 | + pip install -e . |
| 82 | + python setup.py bdist_wheel --all |
| 83 | +
|
| 84 | + - name: Publish Patchright-Python Package |
| 85 | + if: steps.version_check.outputs.proceed == 'true' |
| 86 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 87 | + with: |
| 88 | + packages-dir: playwright-python/dist/ |
| 89 | + verbose: true |
0 commit comments