Documentation #3
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: Documentation | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: # manual trigger | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Git User for Applying Patches | |
| # See this thread for more details https://github.qkg1.topmunity/t/github-actions-bot-email-address/17204/5 | |
| run: | | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git config --global user.name "github-actions[bot]" | |
| - name: Install dependencies | |
| run: sudo apt-get update && sudo apt-get install -y doxygen graphviz | |
| # Build stable documentation | |
| - name: Configure (stable) | |
| run: cmake --preset=ci-ubuntu -Dsleigh_RELEASE_TYPE=stable | |
| - name: Build documentation (stable) | |
| run: cmake --build build --target docs | |
| - name: Copy stable docs | |
| run: | | |
| mkdir -p docs-site/stable | |
| cp -r build/docs/html/* docs-site/stable/ | |
| # Clean and build HEAD documentation | |
| - name: Clean build directory | |
| run: rm -rf build | |
| - name: Configure (HEAD) | |
| run: cmake --preset=ci-ubuntu -Dsleigh_RELEASE_TYPE=HEAD | |
| - name: Build documentation (HEAD) | |
| run: cmake --build build --target docs | |
| - name: Copy HEAD docs | |
| run: | | |
| mkdir -p docs-site/HEAD | |
| cp -r build/docs/html/* docs-site/HEAD/ | |
| # Create landing page | |
| - name: Create landing page | |
| run: | | |
| cat > docs-site/index.html << 'EOF' | |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Sleigh Documentation</title> | |
| <style> | |
| :root { | |
| --bg-color: #f5f5f5; | |
| --text-color: #333; | |
| --text-muted: #666; | |
| --card-bg: white; | |
| --card-shadow: rgba(0,0,0,0.1); | |
| --card-shadow-hover: rgba(0,0,0,0.15); | |
| --link-color: #0066cc; | |
| } | |
| @media (prefers-color-scheme: dark) { | |
| :root { | |
| --bg-color: #1a1a1a; | |
| --text-color: #e0e0e0; | |
| --text-muted: #a0a0a0; | |
| --card-bg: #2d2d2d; | |
| --card-shadow: rgba(0,0,0,0.3); | |
| --card-shadow-hover: rgba(0,0,0,0.4); | |
| --link-color: #4da6ff; | |
| } | |
| } | |
| body { | |
| font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; | |
| max-width: 800px; | |
| margin: 0 auto; | |
| padding: 2rem; | |
| background: var(--bg-color); | |
| color: var(--text-color); | |
| } | |
| h1 { | |
| color: var(--text-color); | |
| } | |
| .cards { | |
| display: flex; | |
| gap: 1rem; | |
| margin-top: 2rem; | |
| } | |
| .card { | |
| flex: 1; | |
| background: var(--card-bg); | |
| border-radius: 8px; | |
| padding: 1.5rem; | |
| text-decoration: none; | |
| color: inherit; | |
| box-shadow: 0 2px 4px var(--card-shadow); | |
| transition: box-shadow 0.2s; | |
| } | |
| .card:hover { | |
| box-shadow: 0 4px 8px var(--card-shadow-hover); | |
| } | |
| .card h2 { | |
| margin-top: 0; | |
| color: var(--link-color); | |
| } | |
| .card p { | |
| color: var(--text-muted); | |
| margin-bottom: 0; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Sleigh Documentation</h1> | |
| <p>Select a documentation version:</p> | |
| <div class="cards"> | |
| <a href="stable/" class="card"> | |
| <h2>Stable</h2> | |
| <p>Documentation for the latest stable release.</p> | |
| </a> | |
| <a href="HEAD/" class="card"> | |
| <h2>HEAD</h2> | |
| <p>Documentation for the latest Ghidra HEAD development version.</p> | |
| </a> | |
| </div> | |
| </body> | |
| </html> | |
| EOF | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs-site | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |