You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.9 KiB

1 year ago
  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.117.0
  29. steps:
  30. - name: Checkout
  31. uses: actions/checkout@v3
  32. with:
  33. fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
  34. - name: Setup Go
  35. uses: actions/setup-go@v4
  36. with:
  37. go-version: '1.21'
  38. - name: Setup Hugo
  39. uses: peaceiris/actions-hugo@v2
  40. with:
  41. hugo-version: '0.117.0'
  42. extended: true
  43. - name: Build with Hugo
  44. env:
  45. # For maximum backward compatibility with Hugo modules
  46. HUGO_ENVIRONMENT: production
  47. HUGO_ENV: production
  48. run: |
  49. hugo \
  50. --gc --minify \
  51. --baseURL "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/"
  52. - name: Upload artifact
  53. uses: actions/upload-pages-artifact@v2
  54. with:
  55. path: ./public
  56. # Deployment job
  57. deploy:
  58. environment:
  59. name: github-pages
  60. url: ${{ steps.deployment.outputs.page_url }}
  61. runs-on: ubuntu-latest
  62. needs: build
  63. steps:
  64. - name: Deploy to GitHub Pages
  65. id: deployment
  66. uses: actions/deploy-pages@v2