Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

devops: merge npm publish workflows into single file (#37559)

Yury Semikhatskybd83bb2fb6d9
diff --git a/.github/workflows/publish_canary.yml b/.github/workflows/publish_release.yml
similarity index 76%
rename from .github/workflows/publish_canary.yml
rename to .github/workflows/publish_release.yml
index 42453f8a37..3fbfe457e2 100644
--- a/.github/workflows/publish_canary.yml
+++ b/.github/workflows/publish_release.yml
@@ -7,17 +7,19 @@ on:
push:
branches:
- release-*
+ release:
+ types: [published]
env:
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
jobs:
- publish-canary:
- name: "publish canary NPM"
+ publish-npm:
+ name: "publish NPM"
runs-on: ubuntu-24.04
if: github.repository == 'microsoft/playwright'
permissions:
- id-token: write # This is required for OIDC login (azure/login) to succeed
+ id-token: write # This is required for OIDC login (azure/login, NPM publish) to succeed
contents: read # This is required for actions/checkout to succeed
environment: allow-publish-driver-to-cdn # This is required for OIDC login (azure/login)
steps:
@@ -28,27 +30,26 @@ jobs:
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build
+
- name: "@next: publish with commit timestamp (triggered manually)"
if: contains(github.ref, 'main') && github.event_name == 'workflow_dispatch'
run: |
node utils/build/update_canary_version.js --alpha --commit-timestamp
utils/publish_all_packages.sh --alpha
- env:
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: "@next: publish with today's date (triggered automatically)"
- if: contains(github.ref, 'main') && github.event_name != 'workflow_dispatch'
+ if: contains(github.ref, 'main') && github.event.schedule
run: |
node utils/build/update_canary_version.js --alpha --today-date
utils/publish_all_packages.sh --alpha
- env:
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: "@beta: publish with commit timestamp (triggered automatically)"
- if: contains(github.ref, 'release') && github.event_name != 'workflow_dispatch'
+ if: contains(github.ref, 'release') && github.event_name == 'push'
run: |
node utils/build/update_canary_version.js --beta --commit-timestamp
utils/publish_all_packages.sh --beta
- env:
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+ - name: "publish release to NPM"
+ if: contains(github.ref, 'release') && github.event_name == 'release'
+ run: utils/publish_all_packages.sh --release
+
- name: Azure Login
uses: azure/login@v2
with:
@@ -57,7 +58,7 @@ jobs:
subscription-id: ${{ secrets.AZURE_PW_CDN_SUBSCRIPTION_ID }}
- name: build & publish driver
env:
- AZ_UPLOAD_FOLDER: driver/next
+ AZ_UPLOAD_FOLDER: ${{ github.event_name == 'release' && 'driver' || 'driver/next' }}
run: |
utils/build/build-playwright-driver.sh
utils/build/upload-playwright-driver.sh
@@ -82,8 +83,13 @@ jobs:
if: contains(github.ref, 'main')
env:
GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }}
- - name: Deploy BETA
+ - name: Deploy Beta
run: bash utils/build/deploy-trace-viewer.sh --beta
- if: contains(github.ref, 'release')
+ if: contains(github.ref, 'release') && github.event_name == 'push'
+ env:
+ GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }}
+ - name: Deploy Stable
+ run: bash utils/build/deploy-trace-viewer.sh --stable
+ if: contains(github.ref, 'release') && github.event_name == 'release'
env:
GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }}
diff --git a/.github/workflows/publish_release_driver.yml b/.github/workflows/publish_release_driver.yml
deleted file mode 100644
index 0f50ec1e50..0000000000
--- a/.github/workflows/publish_release_driver.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-name: "publish release - driver"
-
-on:
- release:
- types: [published]
-
-env:
- ELECTRON_SKIP_BINARY_DOWNLOAD: 1
-
-jobs:
- publish-driver-release:
- name: "publish playwright driver to CDN"
- runs-on: ubuntu-24.04
- if: github.repository == 'microsoft/playwright'
- permissions:
- id-token: write # This is required for OIDC login (azure/login) to succeed
- contents: read # This is required for actions/checkout to succeed
- environment: allow-publish-driver-to-cdn # This is required for OIDC login (azure/login)
- steps:
- - uses: actions/checkout@v5
- - uses: actions/setup-node@v5
- with:
- node-version: 18
- registry-url: 'https://registry.npmjs.org'
- - run: npm ci
- - run: npm run build
- - run: utils/build/build-playwright-driver.sh
- - name: Azure Login
- uses: azure/login@v2
- with:
- client-id: ${{ secrets.AZURE_PW_CDN_CLIENT_ID }}
- tenant-id: ${{ secrets.AZURE_PW_CDN_TENANT_ID }}
- subscription-id: ${{ secrets.AZURE_PW_CDN_SUBSCRIPTION_ID }}
- - run: utils/build/upload-playwright-driver.sh
- env:
- AZ_UPLOAD_FOLDER: driver
diff --git a/.github/workflows/publish_release_npm.yml b/.github/workflows/publish_release_npm.yml
deleted file mode 100644
index 479bdbab2c..0000000000
--- a/.github/workflows/publish_release_npm.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-name: "publish release - NPM"
-
-on:
- release:
- types: [published]
-
-env:
- ELECTRON_SKIP_BINARY_DOWNLOAD: 1
-
-jobs:
- publish-npm-release:
- name: "publish to NPM"
- runs-on: ubuntu-24.04
- if: github.repository == 'microsoft/playwright'
- permissions:
- contents: read
- id-token: write
- steps:
- - uses: actions/checkout@v5
- - uses: actions/setup-node@v5
- with:
- node-version: 18
- registry-url: 'https://registry.npmjs.org'
- - run: npm ci
- - run: npm run build
- - run: utils/publish_all_packages.sh --release
- env:
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
diff --git a/.github/workflows/publish_release_traceviewer.yml b/.github/workflows/publish_release_traceviewer.yml
deleted file mode 100644
index c7cc5a6580..0000000000
--- a/.github/workflows/publish_release_traceviewer.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-name: "publish release - TraceViewer"
-
-on:
- release:
- types: [published]
-
-jobs:
- publish-trace-viewer:
- name: "publish Trace Viewer to trace.playwright.dev"
- runs-on: ubuntu-24.04
- if: github.repository == 'microsoft/playwright'
- steps:
- - uses: actions/checkout@v5
- - uses: actions/setup-node@v5
- with:
- node-version: 18
- - uses: actions/create-github-app-token@v2
- id: app-token
- with:
- app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
- private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
- repositories: trace.playwright.dev
- - name: Deploy Stable
- run: bash utils/build/deploy-trace-viewer.sh --stable
- env:
- GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }}