-
Notifications
You must be signed in to change notification settings - Fork 24
129 lines (116 loc) · 3.23 KB
/
ci.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
name: CI
on:
push:
branches:
- main
- next
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'npm'
node-version-file: '.nvmrc'
- run: npm --version
- run: npm i
- run: npm run lint
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v6.1.2
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node_version:
- 18
- 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: ${{ matrix.node_version }}
- run: npm --version
- run: npm i
- run: npm run build --workspace gatsby-image-gallery
- run: npm run test --ci --coverage --maxWorkers=2 --workspace gatsby-image-gallery
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'npm'
node-version-file: '.nvmrc'
- run: npm i
- run: npm run build --workspace example
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v3.0
with:
publish-dir: 'example/public'
production-deploy: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
netlify-config-path: ./netlify.toml
alias: deploy-preview-${{ github.event.number }}
enable-commit-comment: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: 7b425983-6d24-4fa4-b4a4-50a9df5d44c6
e2e:
runs-on: ubuntu-latest
if: ${{ 1 == 0 }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm i
- name: Install Playwright
run: npx playwright install --with-deps
- name: Build site, serve & run test
run: |
npm --workspace example run build
npm --workspace example run serve-wait
npm --workspace example test
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-results
path: example/test-results
publish:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
needs:
- lint
- test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'npm'
node-version-file: '.nvmrc'
- run: |
if [[ "$(npm --version | cut -f1-2 -d '.')" == "8.5" ]]
then
npm i -g npm@8.6
fi
- run: npm --version
- run: npm i
- run: cp README.md gatsby-image-gallery/
- name: Run Sematic release
working-directory: ./gatsby-image-gallery
run: npx semantic-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}