Repository navigation
122 lines (117 loc) · 5.21 KB
/
Copy pathpublish_release.yml
File metadata and controls
122 lines (117 loc) · 5.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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
if: github.repository == 'microsoft/playwright'
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 "<tag>-pending" (next-pending, beta-pending or
# latest-pending) and leaves <tag> where it is. This moves <tag> 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 }}