-
Notifications
You must be signed in to change notification settings - Fork 121
119 lines (108 loc) · 4.13 KB
/
Copy pathcd.yml
File metadata and controls
119 lines (108 loc) · 4.13 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
name: CD
concurrency: production
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
version:
type: choice
required: true
description: Version
options:
- conventional
- patch
- minor
- major
- prerelease
- from-package
- from-git
prerelease:
type: choice
description: Pre-release
options:
-
- canary
- beta
dryrun:
description: 'Dry-run'
type: boolean
workflow_run:
workflows: ["CI"]
types: [completed]
branches: [main]
run-name: ${{ github.event_name == 'workflow_dispatch' && format('Deploy {0} {1} {2}', inputs.version, inputs.dryrun && '--dry-run' || '', inputs.prerelease && format('--prerelease {0}', inputs.prerelease) || '') || 'Canary release' }}
jobs:
deploy:
runs-on: ubuntu-latest
environment: production
permissions:
contents: write
id-token: write
if: github.event_name == 'workflow_dispatch'
env:
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- uses: actions/setup-node@v4
with:
node-version: 24
# this line is required for the setup-node action to be able to run the npm publish below.
registry-url: 'https://registry.npmjs.org'
- uses: fregante/setup-git-user@v1
- run: npm ci
- run: npm run lint
# Install Playwright after linting, so that we have a faster linting process.
# Caching logic adapted from https://github.com/microsoft/playwright/issues/7249#issuecomment-1385567519
- name: Store Playwright's Version
run: |
PLAYWRIGHT_VERSION=$(npm view @web/test-runner-playwright dependencies.playwright)
echo "Playwright's Version: $PLAYWRIGHT_VERSION"
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: Cache Playwright Browsers for Playwright's Version
id: cache-playwright-browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}
- name: Remove man-db to speed up apt installs
run: sudo apt-get remove -y man-db
- run: npx playwright install --with-deps
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
- run: npx playwright install-deps
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true'
- run: npm run test:unit:all
- run: npm run manifest
- run: npm run build
- run: npx --yes wet-run@1.2.2 release ${{ inputs.version }} ${{ inputs.dryrun && '--dry-run' || '' }} ${{ inputs.prerelease && format('--prerelease {0}', inputs.prerelease) || '' }} --provenance --changelog --github-release --log-level verbose
- name: Get NPM version
id: npm-version
uses: martinbeentjes/npm-get-version-action@v1.3.1
- name: Released ${{ steps.npm-version.outputs.current-version}} ✨
run: echo ${{ steps.npm-version.outputs.current-version}}
canary:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
# this line is required for the setup-node action to be able to run the npm publish below.
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run manifest
- run: npm run build
- run: npx --yes wet-run@1.2.2 release prerelease --prerelease canary --provenance --log-level verbose
- name: Get NPM version
id: npm-version
uses: martinbeentjes/npm-get-version-action@v1.3.1
- name: Released ${{ steps.npm-version.outputs.current-version}} ✨
run: echo ${{ steps.npm-version.outputs.current-version}}