publish release - npm, driver, trace viewer #267
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: "publish release - npm, driver, trace viewer" | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "10 5 * * *" | |
| push: | |
| branches: | |
| - release-* | |
| release: | |
| types: [published] | |
| env: | |
| ELECTRON_SKIP_BINARY_DOWNLOAD: 1 | |
| jobs: | |
| publish-npm-and-driver: | |
| name: "publish NPM and driver" | |
| runs-on: ubuntu-24.04 | |
| if: github.repository == 'microsoft/playwright' | |
| permissions: | |
| 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: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| registry-url: 'https://registry.npmjs.org' | |
| # Ensure npm 11.5.1 or later is installed (for OIDC npm publishing) | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - 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 | |
| - name: "@next: publish with today's date (triggered automatically)" | |
| 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 | |
| - name: "@beta: publish with commit timestamp (triggered automatically)" | |
| 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 | |
| - name: "publish release to NPM" | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| run: utils/publish_all_packages.sh --release | |
| - 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 }} | |
| - name: build & publish driver | |
| env: | |
| AZ_UPLOAD_FOLDER: ${{ github.event_name == 'release' && 'driver' || 'driver/next' }} | |
| run: | | |
| utils/build/build-playwright-driver.sh | |
| utils/build/upload-playwright-driver.sh | |
| 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@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| - 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 Canary | |
| if: contains(github.ref, 'main') && github.event.schedule | |
| run: bash utils/build/deploy-trace-viewer.sh --canary | |
| env: | |
| GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }} | |
| - name: Deploy Beta | |
| if: contains(github.ref, 'release') && github.event_name == 'push' | |
| run: bash utils/build/deploy-trace-viewer.sh --beta | |
| env: | |
| GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }} | |
| - name: Deploy Stable | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| run: bash utils/build/deploy-trace-viewer.sh --stable | |
| env: | |
| GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }} | |
| - name: Deploy Stable (manually) | |
| if: contains(github.ref, 'release') && github.event_name == 'workflow_dispatch' | |
| run: bash utils/build/deploy-trace-viewer.sh --stable | |
| env: | |
| GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }} |