-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (75 loc) · 2.19 KB
/
build-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
81
82
83
84
85
86
87
88
name: Production Build
on:
push:
branches: [ main ]
paths:
- "src/**/*.*"
- "public/**/*.*"
- "package.json"
- "package-lock.json"
- ".github/workflows/**.yml"
pull_request:
branches: [ main ]
paths:
- "src/**/*.*"
- "public/**/*.*"
- "package.json"
- "package-lock.json"
- ".github/workflows/**.yml"
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: "20"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 👷 Checkout Repo
uses: actions/checkout@v4
- name: 🏗️ Setup Node.js ${{ env.NODE_VERSION }} environment
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
check-latest: true
cache: npm
cache-dependency-path: "**/package-lock.json"
- name: ⚡ Cache node_modules
uses: actions/cache@v4
id: cache
with:
path: node_modules
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.NODE_VERSION }}-
- name: 🏗️ Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
- name: 🏗️ Build Site with Vite
run: npm run build
- name: 📦 Create and upload build artifact
uses: actions/upload-artifact@v4
with:
name: pwa-artifact
path: 'build/'
retention-days: 1
call-deploy-workflow:
needs: [build]
uses: mikesprague/reusable-workflows/.github/workflows/pages-deploy.yml@main
secrets:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN}}
with:
artifact-name: pwa-artifact
call-lighthouse-workflow:
needs: [call-deploy-workflow]
uses: mikesprague/reusable-workflows/.github/workflows/lighthouse.yml@main
secrets:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN}}
with:
url: ${{ needs.call-deploy-workflow.outputs.url }}