name: "publish release - npm, trace viewer" on: workflow_dispatch: schedule: - cron: "10 5 * * *" push: branches: - release-* release: types: [published] jobs: publish-npm: name: "publish NPM" runs-on: ubuntu-24.04 # github-actions[bot] is the author of the release created by publish_manual.yml, # that does not need to publish from here. if: github.repository == 'microsoft/playwright' && !(github.event_name == 'release' && github.event.release.author.login == 'github-actions[bot]') permissions: id-token: write # This is required for OIDC login (NPM publish) to succeed contents: read # This is required for actions/checkout to succeed outputs: manifest: ${{ steps.manifest.outputs.artifact-id }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: lts/* 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 - 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 # promote-npm reads it to move the dist-tag once all packages are live. - name: Upload the list of published packages id: manifest uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: npm-publish path: npm-publish.json if-no-files-found: ignore # publish-npm publishes every package under "-pending" (next-pending, beta-pending or # latest-pending) and leaves where it is. This moves to the new version once npm has made # all of the packages live, so next, beta and latest never point at a package whose dependency is # still missing. It is a job of this workflow because the trusted publisher of the packages on npm # is publish_release.yml: npm refuses the OIDC login of another workflow. To retry, re-run the job. promote-npm: name: "move the npm dist-tag" needs: publish-npm # A run that publishes nothing uploads no list. if: needs.publish-npm.outputs.manifest != '' runs-on: ubuntu-24.04 timeout-minutes: 330 permissions: id-token: write # This is required for OIDC login (npm dist-tag) to succeed contents: read # This is required for actions/checkout to succeed steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: lts/* registry-url: 'https://registry.npmjs.org' # npm dist-tag supports OIDC login from npm 11.21.0. - run: npm install -g npm@11.21.1 - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: npm-publish - name: Move the dist-tag once all packages are live run: node utils/promote_npm_packages.js npm-publish.json 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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: lts/* - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 id: app-token with: client-id: ${{ vars.PLAYWRIGHT_APP_CLIENT_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 }}