PatchRight-NodeJS Workflow #8729
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-NodeJS 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: '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-NodeJS Workflow: Install, Patch, Build and Publish Patchright Driver" | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node v18 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install TS-Morph | |
| run: npm 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-NodeJS Package | |
| if: steps.version_check.outputs.proceed == 'true' | |
| run: | | |
| git clone https://github.com/microsoft/playwright --branch ${{ env.playwright_version }} | |
| cd playwright | |
| npm ci | |
| - name: Copy Patchright Patch Scripts | |
| if: steps.version_check.outputs.proceed == 'true' | |
| run: | | |
| git clone https://github.com/Kaliiiiiiiiii-Vinyzu/patchright.git | |
| cp -r patchright/driver_patches ./driver_patches | |
| rm -rf patchright | |
| curl -s "https://raw.githubusercontent.com/Kaliiiiiiiiii-Vinyzu/patchright/refs/heads/main/patchright_driver_patch.js" | tail -n +13 >> patchright_nodejs_patch.js | |
| - name: Patch Playwright-NodeJS Package | |
| if: steps.version_check.outputs.proceed == 'true' | |
| run: | | |
| cd playwright | |
| node "../patchright_nodejs_patch.js" | |
| - name: Generate Playwright Channels | |
| if: steps.version_check.outputs.proceed == 'true' | |
| # Ignore the error exit code, as the script exits 1 when a file is modified. | |
| continue-on-error: true | |
| run: | | |
| cd playwright | |
| node utils/generate_channels.js | |
| - name: Build Playwright-NodeJS Package | |
| if: steps.version_check.outputs.proceed == 'true' | |
| run: | | |
| cd playwright | |
| npm run build | |
| - name: Rebrand to Patchright-NodeJS Package | |
| if: steps.version_check.outputs.proceed == 'true' | |
| run: | | |
| cd playwright | |
| node "../patchright_nodejs_rebranding.js" | |
| - 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](https://github.com/microsoft/playwright). | |
| This Release is only used for Versioning. | |
| draft: false | |
| prerelease: false | |
| - name: Publish Patchright-Core Package | |
| if: steps.version_check.outputs.proceed == 'true' | |
| run: | | |
| cd playwright/packages/patchright-core/ | |
| npm publish --access=public --provenance | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish Patchright Package | |
| if: steps.version_check.outputs.proceed == 'true' | |
| run: | | |
| cd playwright/packages/patchright/ | |
| npm publish --access=public --provenance | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |