Repository navigation
better templates #86
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 Documentation | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Install markdown processor | |
| run: | | |
| npm install marked | |
| - name: Build documentation | |
| run: | | |
| # Create docs build directory | |
| mkdir -p _site/manual | |
| mkdir -p _site/manual/processors | |
| # Function to convert markdown links to HTML links | |
| convert_links() { | |
| sed 's/\(\[.*\]\)(\([^)]*\)\.md)/\1(\2.html)/g' | |
| } | |
| # Convert all markdown files to HTML | |
| find docs/manual -name "*.md" | while read file; do | |
| # Get relative path from docs/manual/ | |
| rel_path=${file#docs/manual/} | |
| filename=$(basename "$rel_path" .md) | |
| dir_path=$(dirname "$rel_path") | |
| # Create target directory | |
| mkdir -p "_site/manual/$dir_path" | |
| echo "Converting $file to HTML..." | |
| # Create HTML with basic styling and navigation | |
| cat > "_site/manual/${rel_path%.md}.html" << 'EOF' | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Transmissions Framework - Manual</title> | |
| <style> | |
| body { | |
| font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; | |
| max-width: 800px; | |
| margin: 0 auto; | |
| padding: 20px; | |
| line-height: 1.6; | |
| color: #333; | |
| } | |
| h1, h2, h3 { color: #2c3e50; } | |
| pre { | |
| background: #f8f9fa; | |
| padding: 15px; | |
| border-radius: 5px; | |
| overflow-x: auto; | |
| border: 1px solid #e9ecef; | |
| } | |
| code { | |
| background: #f8f9fa; | |
| padding: 2px 6px; | |
| border-radius: 3px; | |
| font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; | |
| } | |
| pre code { | |
| background: none; | |
| padding: 0; | |
| } | |
| a { | |
| color: #0066cc; | |
| text-decoration: none; | |
| } | |
| a:hover { | |
| text-decoration: underline; | |
| } | |
| blockquote { | |
| border-left: 4px solid #ddd; | |
| margin: 0; | |
| padding-left: 20px; | |
| color: #666; | |
| font-style: italic; | |
| } | |
| .nav { | |
| margin-bottom: 30px; | |
| padding: 15px; | |
| background: #f8f9fa; | |
| border-radius: 8px; | |
| border: 1px solid #e9ecef; | |
| } | |
| .nav a { | |
| margin-right: 20px; | |
| font-weight: 500; | |
| padding: 5px 10px; | |
| border-radius: 4px; | |
| transition: background-color 0.2s; | |
| } | |
| .nav a:hover { | |
| background-color: #e9ecef; | |
| text-decoration: none; | |
| } | |
| table { | |
| border-collapse: collapse; | |
| width: 100%; | |
| margin: 20px 0; | |
| } | |
| th, td { | |
| border: 1px solid #ddd; | |
| padding: 8px; | |
| text-align: left; | |
| } | |
| th { | |
| background-color: #f8f9fa; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="nav"> | |
| <a href="index.html">Home</a> | |
| <a href="concepts.html">Concepts</a> | |
| <a href="apps.html">Apps</a> | |
| <a href="processors/processors.html">Processors</a> | |
| <a href="flow.html">Flow Control</a> | |
| </div> | |
| EOF | |
| # Convert markdown to HTML with link conversion and append | |
| convert_links < "$file" | npx marked >> "_site/manual/${rel_path%.md}.html" | |
| echo "</body></html>" >> "_site/manual/${rel_path%.md}.html" | |
| done | |
| # Create main index redirect | |
| cat > _site/index.html << 'EOF' | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Transmissions Framework Documentation</title> | |
| <meta http-equiv="refresh" content="0; url=./manual/index.html"> | |
| <link rel="canonical" href="./manual/index.html"> | |
| </head> | |
| <body> | |
| <p>Redirecting to <a href="./manual/index.html">documentation</a>...</p> | |
| </body> | |
| </html> | |
| EOF | |
| echo "Built documentation files:" | |
| find _site -type f -name "*.html" | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| deploy: | |
| if: github.ref == 'refs/heads/main' | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |