eliashaeussler/cache-warmup

View on GitHub
.github/workflows/docs.yaml

Summary

Maintainability
Test Coverage
name: Documentation
on:
  push:
    tags:
      - '*'
  workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

# Allow one concurrent deployment
concurrency:
  group: "pages"
  cancel-in-progress: true

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      # Prepare environment
      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 8.3
          coverage: none
      - name: Setup Pages
        uses: actions/configure-pages@v5

      # Install dependencies
      - name: Install Frontend dependencies
        run: npm ci

      # Render documentation
      - name: Render documentation
        run: npm run docs:build

      # Deploy documentation
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: 'docs/.vitepress/dist'
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4

      # Warm up cache
      - name: Run cache warmup
        uses: eliashaeussler/cache-warmup-action@v1
        with:
          sitemaps: ${{ steps.deployment.outputs.page_url }}/sitemap.xml
          progress: true
          verbosity: v