1- name: Generate HTML Report
1+ name: Generate and Deploy to GitHub Pages
22
33on:
44 push:
55 branches: [ main ]
66 paths:
77 - 'Graph Analysis/unified_analysis.py'
88 - 'reports/unified_analysis_report_explained.md'
9+ - 'docs/script.js'
10+ - 'docs/style.css'
911 workflow_dispatch: # Allow manual trigger
1012
1113permissions:
12- contents: write
14+ contents: read
15+ pages: write
16+ id-token: write
17+
18+ concurrency:
19+ group: "pages"
20+ cancel-in-progress: false
1321
1422jobs:
15- generate-html :
23+ generate-and-deploy :
1624 runs-on: ubuntu-latest
25+ environment:
26+ name: github-pages
27+ url: ${{ steps.deployment.outputs.page_url }}
1728
1829 steps:
1930 - name: Checkout repository
2031 uses: actions/checkout@v4
21- with:
22- fetch-depth: 0 # Fetch full history for proper git operations
2332
2433 - name: Set up Python
2534 uses: actions/setup-python@v4
@@ -35,16 +44,15 @@ jobs:
3544 run: |
3645 python "Graph Analysis/unified_analysis.py" --html --html-output docs/index.html
3746
38- - name: Commit and push if changed
39- run: |
40- git config --local user.email "action@github.com"
41- git config --local user.name "GitHub Action"
42- git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
43- git add docs/index.html
44- if git diff --staged --quiet; then
45- echo "No changes to commit"
46- else
47- git commit -m "Auto-update HTML report [skip ci]"
48- git push origin HEAD:main
49- fi
47+ - name: Setup Pages
48+ uses: actions/configure-pages@v3
49+
50+ - name: Upload artifact
51+ uses: actions/upload-pages-artifact@v2
52+ with:
53+ path: './docs'
54+
55+ - name: Deploy to GitHub Pages
56+ id: deployment
57+ uses: actions/deploy-pages@v2
5058
0 commit comments