-
Notifications
You must be signed in to change notification settings - Fork 11
176 lines (151 loc) · 4.5 KB
/
ci-cd.yml
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: CI/CD
on:
push:
branches:
- main
- rc
pull_request:
jobs:
dependabot:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: fastify/github-action-merge-dependabot@v3
with:
merge-method: 'rebase'
target: 'minor'
github-token: ${{ github.token }}
test:
name: Test with Node v${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
matrix:
node: [20]
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Setup Node v${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v4
with:
version: 8.10.1
run_install: |
- recursive: true
args: [--frozen-lockfile]
# Docs must always be built to ensure the components.d.ts is generated
# inside the src folder; without it ts linting fails for docs files!
- name: Build
run: |
pnpm run build
pnpm run build:docs
env:
GH_TOKEN: ${{ github.token }}
MODE: gh_pages
- name: Lint source files
run: pnpm run lint
- name: Run unit tests
run: pnpm run test:unit
# e2e tests are still not stable due to flaky screenshot diffing in stencil
#- name: Run e2e tests
# if: github.event_name == 'pull_request'
# run: pnpm run test:e2e
- name: Archive bin_dist artifacts
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/rc'
uses: actions/upload-artifact@v3
with:
name: bin_dist
path: |
bin
dist
hydrate
retention-days: 1
- name: Archive dist_docs artifacts
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: dist_docs
path: dist_docs
retention-days: 1
- name: Coveralls
if: github.ref == 'refs/heads/main'
uses: coverallsapp/github-action@master
continue-on-error: true
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
document:
if: github.ref == 'refs/heads/main'
name: Deploy dist_docs to GitHub pages
needs: test
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Download dist_docs artifacts
uses: actions/download-artifact@v3
with:
name: dist_docs
path: dist_docs
- name: Deploy docs
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: dist_docs
- name: Invalidate Cloudfront
uses: chetan/invalidate-cloudfront-action@v2
env:
PATHS: '/*'
DISTRIBUTION: ${{ secrets.AWS_CF_DISTRIBUTION_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-east-1
release:
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/rc'
name: npm publish / GitHub release
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
node: [20]
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v4
with:
version: 8.10.1
run_install: |
- recursive: true
args: [--frozen-lockfile]
- name: Download bin_dist artifacts
uses: actions/download-artifact@v3
with:
name: bin_dist
path: ./
- name: Semantic Release
if: success()
run: pnpm exec semantic-release --extends ./config/.releaserc.cjs
env:
GH_TOKEN: ${{ github.token }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}