feat: add interactive virtual terminal demo to website #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
| # SPDX-License-Identifier: MIT | |
| # Copyright (c) 2025 Ralf Anton Beier | |
| name: Deploy Landing Page to GitHub Pages | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'index.html' | |
| - '.github/workflows/deploy-pages.yml' | |
| workflow_dispatch: # Allow manual triggering | |
| # 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: | |
| # Build job | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Setup Python and generate coverage | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| - name: Install dependencies and generate coverage | |
| run: | | |
| uv sync | |
| # Generate fresh coverage data for the landing page | |
| uv run pytest tests/ --cov=loxone_mcp --cov-report=json --cov-report=term-missing || true | |
| # Ensure coverage.json exists even if tests fail | |
| if [ ! -f coverage.json ]; then | |
| echo '{"totals": {"percent_covered": 0, "covered_lines": 0, "num_statements": 0}}' > coverage.json | |
| fi | |
| - name: Create pages directory | |
| run: | | |
| mkdir -p _site | |
| - name: Copy landing page files | |
| run: | | |
| # Copy main landing page | |
| cp index.html _site/ | |
| # Copy additional documentation if needed | |
| # cp additional_docs.md _site/ | |
| # Copy coverage data for real-time display | |
| if [ -f coverage.json ]; then | |
| cp coverage.json _site/ | |
| echo "✅ Coverage data copied to deployment" | |
| ls -la _site/coverage.json | |
| else | |
| echo "❌ No coverage.json found" | |
| fi | |
| # Create a simple 404 page that redirects to main | |
| cat > _site/404.html << 'EOF' | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="refresh" content="0; url=/"> | |
| <title>Redirecting...</title> | |
| </head> | |
| <body> | |
| <p>Redirecting to <a href="/">MCP Loxone Gen1</a>...</p> | |
| </body> | |
| </html> | |
| EOF | |
| - name: Add CNAME for custom domain (if needed) | |
| run: | | |
| # Uncomment and modify if you have a custom domain | |
| # echo "your-domain.com" > _site/CNAME | |
| - name: Generate sitemap | |
| run: | | |
| cat > _site/sitemap.xml << 'EOF' | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | |
| <url> | |
| <loc>https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/</loc> | |
| <lastmod>$(date -u +%Y-%m-%dT%H:%M:%S+00:00)</lastmod> | |
| <changefreq>weekly</changefreq> | |
| <priority>1.0</priority> | |
| </url> | |
| </urlset> | |
| EOF | |
| - name: Generate robots.txt | |
| run: | | |
| cat > _site/robots.txt << 'EOF' | |
| User-agent: * | |
| Allow: / | |
| Sitemap: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/sitemap.xml | |
| EOF | |
| - name: Optimize HTML | |
| run: | | |
| # Add meta tags for better SEO and social sharing | |
| sed -i '/<title>/a\ | |
| <meta name="description" content="MCP Loxone Gen1 - Model Context Protocol for smart home automation with natural language commands in German, English, and mixed languages.">\ | |
| <meta name="keywords" content="Loxone, MCP, Model Context Protocol, Smart Home, Home Automation, LLM, AI Assistant, German, Multilingual">\ | |
| <meta name="author" content="MCP Loxone Gen1">\ | |
| <meta property="og:title" content="MCP Loxone Gen1 - Smart Home Automation for LLMs">\ | |
| <meta property="og:description" content="Control your Loxone Generation 1 Miniserver through AI assistants with natural language commands.">\ | |
| <meta property="og:type" content="website">\ | |
| <meta property="og:url" content="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/">\ | |
| <meta name="twitter:card" content="summary_large_image">\ | |
| <meta name="twitter:title" content="MCP Loxone Gen1 - Smart Home Automation for LLMs">\ | |
| <meta name="twitter:description" content="Control your Loxone Generation 1 Miniserver through AI assistants with natural language commands.">' _site/index.html | |
| - name: Update GitHub repository links | |
| run: | | |
| # Replace placeholder GitHub links with actual repository | |
| sed -i 's|https://github.com/yourusername/mcp-loxone-gen1|https://github.com/${{ github.repository }}|g' _site/index.html | |
| - name: Add analytics (optional) | |
| run: | | |
| # Add Google Analytics if GA_MEASUREMENT_ID is set as a repository secret | |
| if [ -n "${{ secrets.GA_MEASUREMENT_ID }}" ]; then | |
| sed -i '/<\/head>/i\ | |
| <!-- Google Analytics -->\ | |
| <script async src="https://www.googletagmanager.com/gtag/js?id=${{ secrets.GA_MEASUREMENT_ID }}"></script>\ | |
| <script>\ | |
| window.dataLayer = window.dataLayer || [];\ | |
| function gtag(){dataLayer.push(arguments);}\ | |
| gtag("js", new Date());\ | |
| gtag("config", "${{ secrets.GA_MEASUREMENT_ID }}");\ | |
| </script>' _site/index.html | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: '_site' | |
| # Deployment job | |
| deploy: | |
| 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 | |
| - name: Comment on PR with deployment URL | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { owner, repo } = context.repo; | |
| const deploymentUrl = '${{ steps.deployment.outputs.page_url }}'; | |
| // Create a deployment status | |
| github.rest.issues.createComment({ | |
| owner, | |
| repo, | |
| issue_number: context.issue.number || 1, | |
| body: `🚀 Landing page deployed successfully!\n\n📍 **Live URL**: ${deploymentUrl}\n\n✅ The MCP Loxone Gen1 landing page is now live and accessible.` | |
| }).catch(() => { | |
| // Ignore errors if no issue/PR context | |
| console.log('No PR context for comment'); | |
| }); |