PatchRight-NodeJS Workflow #1925
This file contains 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' | |
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: | | |
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: Patch Playwright-NodeJS Package | |
if: steps.version_check.outputs.proceed == 'true' | |
run: | | |
curl -s "https://raw.githubusercontent.com/Kaliiiiiiiiii-Vinyzu/patchright/refs/heads/main/patchright_driver_patch.js" | tail -n +9 >> patchright_nodejs_patch.js | |
cd playwright | |
node "../patchright_nodejs_patch.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 }} |