-
Notifications
You must be signed in to change notification settings - Fork 67
83 lines (72 loc) · 2.18 KB
/
frontend-build.yml
File metadata and controls
83 lines (72 loc) · 2.18 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
name: Frontend Build
on:
workflow_call:
inputs:
node_version:
description: Node.js version
required: true
default: "24.x"
type: string
artifact_name:
description: Artifact name to publish
required: false
default: "frontend-dist"
type: string
artifact_retention_days:
description: Number of days to keep the uploaded artifact
required: false
default: 7
type: number
site_base_path:
description: Path base to use for the Astro build
required: false
default: "/"
type: string
permissions:
contents: read
jobs:
build:
name: Frontend Build
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/frontend
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ inputs.node_version }}
cache: pnpm
cache-dependency-path: src/frontend/pnpm-lock.yaml
- name: Install deps
run: pnpm install --frozen-lockfile
- name: Build frontend
env:
MODE: production
ASTRO_TELEMETRY_DISABLED: 1
ASTRO_BASE_PATH: ${{ inputs.site_base_path }}
run: pnpm build:production
- name: Check dist
run: |
if [ ! -d "dist" ]; then
echo "Frontend build failed - dist directory not found"
exit 1
fi
if [ ! -f "dist/index.html" ]; then
echo "Frontend build incomplete - index.html not found"
exit 1
fi
ls -la dist
- name: Upload artifact
if: ${{ always() }}
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: ${{ inputs.artifact_name }}
path: src/frontend/dist
if-no-files-found: warn
retention-days: ${{ inputs.artifact_retention_days }}