-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (113 loc) · 4.99 KB
/
Copy pathdeploy.yml
File metadata and controls
144 lines (113 loc) · 4.99 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
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
name: Deploy to GitHub Pages
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout Portfolio Hub
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install tree utility
run: sudo apt-get update && sudo apt-get install -y tree
# =========================================================================
# Debug Step: Print Repo Root Tree
# =========================================================================
- name: Print Repository Tree (Debug)
run: |
echo "Printing repository structure (shows synced sub-project folders):"
tree -L 2 -I 'node_modules|.git'
# =========================================================================
# 1. Quality Gates (Format, Lint, Type Check)
# =========================================================================
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Check Code Formatting (Prettier)
run: npx prettier --check . || echo "Format check warning"
- name: Run Linter
run: npm run lint || echo "Linter warning"
- name: TypeScript Compiler Verification (Type Check)
run: npx tsc --noEmit
# =========================================================================
# 2. Automated SEO & Asset Generation
# =========================================================================
- name: Generate Sitemap, Robots.txt, RSS, and Search Index
run: node scripts/generate-seo-assets.cjs --portfolio .
# =========================================================================
# 3. Build Main Web Application
# =========================================================================
- name: Build Portfolio Hub
run: npm run build
- name: Print dist/ Tree Before Merging Sub-projects (Debug)
run: |
echo "Printing dist folder before merging static project builds:"
tree -L 2 dist/
# =========================================================================
# 4. Merge Sub-Project Build Folders
# =========================================================================
- name: Copy Static Sub-Project Builds to Output
run: |
for dir in */; do
dir=${dir%/} # strip trailing slash
if [[ "$dir" != "node_modules" && "$dir" != "dist" && "$dir" != "public" && "$dir" != "src" && "$dir" != ".github" && "$dir" != ".git" && "$dir" != "inspiration" && "$dir" != "scripts" && "$dir" != "automation" && "$dir" != "docs" ]]; then
if [[ -f "$dir/index.html" ]]; then
echo "Merging sub-project build output: $dir"
mkdir -p dist/$dir
cp -r $dir/* dist/$dir/
fi
fi
done
shell: bash
# =========================================================================
# Debug Step: Print final dist/ tree showing merged projects
# =========================================================================
- name: Print Final dist/ Tree (Debug)
run: |
echo "Printing final dist directory structure showing merged projects:"
tree -L 3 dist/
# =========================================================================
# Upload Final Compiled Build as Artifact
# =========================================================================
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: portfolio-dist
path: dist/
if-no-files-found: error
# =========================================================================
# 4.5 Validate Deployment Structure (Prevent 404s)
# =========================================================================
- name: Validate Deployed Files
run: node scripts/validate-deployment.cjs
# =========================================================================
# 5. Deploy to GitHub Pages
# =========================================================================
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# =========================================================================
# 5.5 Verify Deployed Live URLs (HTTP 200)
# =========================================================================
- name: Verify Live URLs
run: node scripts/verify-live-urls.cjs