Stub in Red Rising #445
Workflow file for this run
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/workflows/jekyll.yml | |
| name: Test and Deploy Jekyll site to Pages | |
| on: | |
| # Runs on pushes to ANY branch | |
| push: | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # 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. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| # Test job - Runs on EVERY branch | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| bundler-cache: true | |
| cache-version: 0 | |
| - name: Run linter | |
| run: bundle exec rubocop | |
| - name: Run tests | |
| run: bundle exec ruby -I _plugins -I _tests -e "require 'test_helper'; Dir.glob('_tests/**/test_*.rb').each { |f| load f }" | |
| - name: Check for strict Liquid errors | |
| run: bundle exec ruby _bin/check_strict.rb | |
| # Build job | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1.244.0 | |
| with: | |
| bundler-cache: true | |
| cache-version: 0 | |
| - name: Setup Pages | |
| id: pages | |
| uses: actions/configure-pages@v5 | |
| - name: Build with Jekyll | |
| run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" | |
| env: | |
| JEKYLL_ENV: production | |
| - name: Validate HTML structure | |
| run: | | |
| echo "Checking for missing DOCTYPE declarations..." | |
| missing_doctype=$(find _site -name '*.html' -exec sh -c 'head -1 "$1" | grep -qv "^<!DOCTYPE" && echo "$1"' _ {} \;) | |
| if [ -n "$missing_doctype" ]; then | |
| echo "ERROR: The following files are missing <!DOCTYPE html>:" | |
| echo "$missing_doctype" | |
| echo "This usually indicates a broken layout chain or corrupted front matter." | |
| exit 1 | |
| fi | |
| echo "Checking for raw front matter in output..." | |
| # Only check for --- at the START of files (actual unprocessed front matter) | |
| # Ignore --- inside code blocks (legitimate content like Jekyll tutorials) | |
| raw_frontmatter=$(find _site -name '*.html' -exec sh -c 'head -1 "$1" | grep -q "^---$" && echo "$1"' _ {} \;) | |
| if [ -n "$raw_frontmatter" ]; then | |
| echo "ERROR: Raw front matter delimiters found at start of HTML files:" | |
| echo "$raw_frontmatter" | |
| exit 1 | |
| fi | |
| echo "All HTML structure checks passed." | |
| - name: Check for broken links | |
| run: bundle exec ruby _bin/check_links.rb | |
| - name: Upload artifact | |
| # Only upload if we are on main (where deployment happens) | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/upload-pages-artifact@v4 | |
| # Deployment job | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| # This matches the condition above, ensuring we only try to deploy if we uploaded | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |