Merge pull request #26 from Genovese-Felipe/copilot/fix-25 #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Deploy GitHub Pages | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'docs/**' | |
| - 'outputs/**' | |
| - 'data/**' | |
| - 'scripts/**' | |
| - '_config.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| name: 🏗️ Build Site | |
| steps: | |
| - name: 📥 Checkout | |
| uses: actions/checkout@v4 | |
| - name: 🔧 Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: 🚀 Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: 📦 Install Dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| if [ -f requirements.txt ]; then | |
| pip install -r requirements.txt | |
| else | |
| pip install pandas numpy plotly dash | |
| fi | |
| - name: 📊 Generate Data (if needed) | |
| run: | | |
| if [ -f scripts/data_gen.py ]; then | |
| echo "🔄 Generating synthetic data..." | |
| python scripts/data_gen.py | |
| echo "✅ Data generation completed" | |
| fi | |
| - name: 🎨 Update Dashboard Assets | |
| run: | | |
| echo "📁 Copying dashboard assets..." | |
| # Ensure assets directory exists | |
| mkdir -p docs/assets/dashboards | |
| # Copy existing dashboards to docs | |
| if [ -d outputs ]; then | |
| cp outputs/*.html docs/assets/dashboards/ 2>/dev/null || echo "No HTML files to copy from outputs" | |
| fi | |
| # Copy any other important dashboards | |
| find . -name "*.html" -not -path "./docs/*" -not -path "./.git/*" -not -path "./node_modules/*" | head -10 | while read file; do | |
| if [ -f "$file" ]; then | |
| echo "Copying $file to docs/assets/dashboards/" | |
| cp "$file" docs/assets/dashboards/ | |
| fi | |
| done | |
| echo "✅ Dashboard assets updated" | |
| - name: 🔧 Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.1' | |
| bundler-cache: true | |
| - name: 📝 Create Gemfile if not exists | |
| run: | | |
| if [ ! -f docs/Gemfile ]; then | |
| cat > docs/Gemfile << 'EOF' | |
| source "https://rubygems.org" | |
| gem "jekyll", "~> 4.3.0" | |
| gem "minima", "~> 2.5" | |
| gem "jekyll-feed", "~> 0.12" | |
| gem "jekyll-sitemap" | |
| gem "jekyll-seo-tag" | |
| gem "webrick", "~> 1.7" | |
| EOF | |
| fi | |
| - name: 📦 Install Jekyll Dependencies | |
| run: | | |
| cd docs | |
| bundle install | |
| - name: 🏗️ Build with Jekyll | |
| run: | | |
| cd docs | |
| bundle exec jekyll build --verbose | |
| echo "✅ Jekyll build completed" | |
| # List generated files | |
| echo "📁 Generated files:" | |
| ls -la _site/ | |
| - name: 📤 Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs/_site | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| name: 🚀 Deploy to GitHub Pages | |
| steps: | |
| - name: 🌐 Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| - name: ✅ Deployment Summary | |
| run: | | |
| echo "🎉 Site deployed successfully!" | |
| echo "🌐 URL: ${{ steps.deployment.outputs.page_url }}" | |
| echo "📊 Dashboard URL: ${{ steps.deployment.outputs.page_url }}assets/dashboards/" |