Deploy GitHub Pages Dashboard #221
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: Deploy GitHub Pages Dashboard | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'reports/**' | |
| - 'docs/**' | |
| - 'scripts/generate_dashboard_data.py' | |
| workflow_run: | |
| workflows: ["Ghost Hunter - Automated CVE Hunt"] | |
| types: [completed] | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| build-deploy: | |
| name: π Build and Deploy Dashboard | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π₯ Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: π Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: π¦ Install Dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| - name: π Generate Dashboard Data | |
| env: | |
| PYTHONPATH: ${{ github.workspace }} | |
| run: | | |
| mkdir -p docs/_data | |
| # Copy latest report if exists | |
| if ls reports/ghost_report_*.json 1> /dev/null 2>&1; then | |
| LATEST=$(ls -t reports/ghost_report_*.json | head -1) | |
| cp "$LATEST" docs/_data/latest.json | |
| else | |
| echo "{}" > docs/_data/latest.json | |
| fi | |
| # Generate additional data files (only if database exists) | |
| if [ -f ghost_log.db ]; then | |
| python scripts/generate_dashboard_data.py | |
| else | |
| echo "β οΈ No database found, skipping dashboard data generation" | |
| echo '{"generated_at":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","summary":{},"ghosts":[]}' > docs/_data/latest.json | |
| echo '{"generated_at":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","timeline":[]}' > docs/_data/trends.json | |
| echo '{"generated_at":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","summary":{},"status_breakdown":{},"source_breakdown":{},"age_distribution":{}}' > docs/_data/stats.json | |
| fi | |
| - name: π¨ Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: π€ Upload Pages Artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs | |
| - name: π Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| - name: β Deployment Complete | |
| run: | | |
| echo "## π Dashboard Deployed" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Dashboard URL: ${{ steps.deployment.outputs.page_url }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "The Ghost CVE dashboard has been successfully deployed!" >> $GITHUB_STEP_SUMMARY |