hugo.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # Sample workflow for building and deploying a Hugo site to GitHub Pages
  2. name: Deploy Hugo site to Pages
  3. on:
  4. # Runs on pushes targeting the default branch
  5. push:
  6. branches: ["main"]
  7. # Allows you to run this workflow manually from the Actions tab
  8. workflow_dispatch:
  9. # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
  10. permissions:
  11. contents: read
  12. pages: write
  13. id-token: write
  14. # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
  15. # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
  16. concurrency:
  17. group: "pages"
  18. cancel-in-progress: false
  19. # Default to bash
  20. defaults:
  21. run:
  22. shell: bash
  23. jobs:
  24. # Build job
  25. build:
  26. runs-on: ubuntu-latest
  27. env:
  28. HUGO_VERSION: 0.128.0
  29. steps:
  30. - name: Install Hugo CLI
  31. run: |
  32. wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
  33. && sudo dpkg -i ${{ runner.temp }}/hugo.deb
  34. - name: Install Dart Sass
  35. run: sudo snap install dart-sass
  36. - name: Checkout
  37. uses: actions/checkout@v4
  38. with:
  39. submodules: recursive
  40. - name: Setup Pages
  41. id: pages
  42. uses: actions/configure-pages@v5
  43. - name: Install Node.js dependencies
  44. run: npm ci || true
  45. - name: Build with Hugo
  46. env:
  47. HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
  48. HUGO_ENVIRONMENT: production
  49. run: |
  50. hugo \
  51. --minify \
  52. --baseURL "${{ steps.pages.outputs.base_url }}/"
  53. - name: Run Pagefind
  54. run: npx -y pagefind --site public
  55. - name: Upload artifact
  56. uses: actions/upload-pages-artifact@v3
  57. with:
  58. path: ./public
  59. # Deployment job
  60. deploy:
  61. environment:
  62. name: github-pages
  63. url: ${{ steps.deployment.outputs.page_url }}
  64. runs-on: ubuntu-latest
  65. needs: build
  66. steps:
  67. - name: Deploy to GitHub Pages
  68. id: deployment
  69. uses: actions/deploy-pages@v4