-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (68 loc) · 1.72 KB
/
test-and-deploy.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
name: Test & Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
test:
name: Test 🧪
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4.1.4
- uses: actions/setup-node@v4.0.2
with:
node-version-file: ".nvmrc"
- name: Restore npm cache
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Setup Biome
uses: biomejs/setup-biome@v2
- name: Run Biome
run: biome ci .
- name: Validate codeowners
run: npm run codeowners:check
- name: Build filters
run: npm run build
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: out
path: out/
deploy:
name: Deploy 🚀
needs: test
runs-on: ubuntu-latest
timeout-minutes: 5
if: >
(
github.ref == 'refs/heads/main' &&
contains(github.event.head_commit.modified, 'filters/') &&
github.event_name == 'push'
) || github.event_name == 'workflow_dispatch'
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4.1.4
with:
ref: deploy
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: out
path: out
- name: Deploy to branch
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: out
branch: deploy
clean: true