Deploy Landing Page #32
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
| # GitHub Actions workflow for deploying the Codebase Interface landing page | |
| name: Deploy Landing Page | |
| on: | |
| push: | |
| branches: | |
| - main | |
| schedule: | |
| # Daily sync at 6 AM UTC to pull updates from external repositories | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| force_rebuild: | |
| description: 'Force rebuild of all content' | |
| required: false | |
| default: 'false' | |
| # Allow only one deployment at a time | |
| concurrency: | |
| group: "deploy" | |
| cancel-in-progress: false | |
| # Sets permissions for GitHub Pages deployment | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Setup Task | |
| uses: arduino/setup-task@v2 | |
| with: | |
| version: 3.x | |
| - name: Install Python dependencies via Task | |
| run: task setup | |
| - name: Verify critical plugins | |
| run: | | |
| python -c "import mkdocs_minify_plugin; print('✅ mkdocs-minify-plugin installed')" | |
| markdownlint --version && echo "✅ markdownlint-cli installed" | |
| echo "✅ All tools verified" | |
| - name: Validate configuration | |
| run: | | |
| task validate | |
| echo "✅ Configuration and linting validation passed" | |
| - name: Build production landing page | |
| run: | | |
| task build-production | |
| echo "✅ Production landing page built successfully" | |
| - name: Add .nojekyll file | |
| run: | | |
| touch ./site/.nojekyll | |
| echo "✅ Added .nojekyll file for GitHub Pages" | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./site | |
| deploy: | |
| needs: build | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| lighthouse: | |
| needs: deploy | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Install Lighthouse CI | |
| run: npm install -g @lhci/cli | |
| - name: Run Lighthouse CI | |
| run: | | |
| lhci autorun --upload.target=temporary-public-storage | |
| env: | |
| LHCI_GITHUB_APP_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Comment PR with Lighthouse results | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: '🔍 Lighthouse audit completed! Check the results in the workflow logs.' | |
| }); | |
| notify: | |
| needs: [deploy, lighthouse] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Notify deployment status | |
| run: | | |
| if [ "${{ needs.deploy.result }}" == "success" ]; then | |
| echo "🚀 Landing page successfully deployed to https://codebase-interface.github.io" | |
| else | |
| echo "❌ Deployment failed" | |
| exit 1 | |
| fi |