1+ name : Build and Deploy GitHub Pages
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ paths :
7+ - ' docs/**'
8+ - ' outputs/**'
9+ - ' data/**'
10+ - ' scripts/**'
11+ - ' _config.yml'
12+ workflow_dispatch :
13+
14+ permissions :
15+ contents : read
16+ pages : write
17+ id-token : write
18+
19+ concurrency :
20+ group : " pages"
21+ cancel-in-progress : false
22+
23+ jobs :
24+ build :
25+ runs-on : ubuntu-latest
26+ name : 🏗️ Build Site
27+
28+ steps :
29+ - name : 📥 Checkout
30+ uses : actions/checkout@v4
31+
32+ - name : 🔧 Setup Pages
33+ uses : actions/configure-pages@v4
34+
35+ - name : 🚀 Setup Python
36+ uses : actions/setup-python@v4
37+ with :
38+ python-version : ' 3.9'
39+
40+ - name : 📦 Install Dependencies
41+ run : |
42+ python -m pip install --upgrade pip
43+ if [ -f requirements.txt ]; then
44+ pip install -r requirements.txt
45+ else
46+ pip install pandas numpy plotly dash
47+ fi
48+
49+ - name : 📊 Generate Data (if needed)
50+ run : |
51+ if [ -f scripts/data_gen.py ]; then
52+ echo "🔄 Generating synthetic data..."
53+ python scripts/data_gen.py
54+ echo "✅ Data generation completed"
55+ fi
56+
57+ - name : 🎨 Update Dashboard Assets
58+ run : |
59+ echo "📁 Copying dashboard assets..."
60+
61+ # Ensure assets directory exists
62+ mkdir -p docs/assets/dashboards
63+
64+ # Copy existing dashboards to docs
65+ if [ -d outputs ]; then
66+ cp outputs/*.html docs/assets/dashboards/ 2>/dev/null || echo "No HTML files to copy from outputs"
67+ fi
68+
69+ # Copy any other important dashboards
70+ find . -name "*.html" -not -path "./docs/*" -not -path "./.git/*" -not -path "./node_modules/*" | head -10 | while read file; do
71+ if [ -f "$file" ]; then
72+ echo "Copying $file to docs/assets/dashboards/"
73+ cp "$file" docs/assets/dashboards/
74+ fi
75+ done
76+
77+ echo "✅ Dashboard assets updated"
78+
79+ - name : 🔧 Setup Ruby
80+ uses : ruby/setup-ruby@v1
81+ with :
82+ ruby-version : ' 3.1'
83+ bundler-cache : true
84+
85+ - name : 📝 Create Gemfile if not exists
86+ run : |
87+ if [ ! -f docs/Gemfile ]; then
88+ cat > docs/Gemfile << 'EOF'
89+ source "https://rubygems.org"
90+
91+ gem "jekyll", "~> 4.3.0"
92+ gem "minima", "~> 2.5"
93+ gem "jekyll-feed", "~> 0.12"
94+ gem "jekyll-sitemap"
95+ gem "jekyll-seo-tag"
96+ gem "webrick", "~> 1.7"
97+ EOF
98+ fi
99+
100+ - name : 📦 Install Jekyll Dependencies
101+ run : |
102+ cd docs
103+ bundle install
104+
105+ - name : 🏗️ Build with Jekyll
106+ run : |
107+ cd docs
108+ bundle exec jekyll build --verbose
109+ echo "✅ Jekyll build completed"
110+
111+ # List generated files
112+ echo "📁 Generated files:"
113+ ls -la _site/
114+
115+ - name : 📤 Upload artifact
116+ uses : actions/upload-pages-artifact@v3
117+ with :
118+ path : docs/_site
119+
120+ deploy :
121+ environment :
122+ name : github-pages
123+ url : ${{ steps.deployment.outputs.page_url }}
124+ runs-on : ubuntu-latest
125+ needs : build
126+ name : 🚀 Deploy to GitHub Pages
127+
128+ steps :
129+ - name : 🌐 Deploy to GitHub Pages
130+ id : deployment
131+ uses : actions/deploy-pages@v4
132+
133+ - name : ✅ Deployment Summary
134+ run : |
135+ echo "🎉 Site deployed successfully!"
136+ echo "🌐 URL: ${{ steps.deployment.outputs.page_url }}"
137+ echo "📊 Dashboard URL: ${{ steps.deployment.outputs.page_url }}assets/dashboards/"
0 commit comments