diff --git a/.github/workflows/preview-pr.yml b/.github/workflows/preview-pr.yml new file mode 100644 index 000000000..238ec0ef5 --- /dev/null +++ b/.github/workflows/preview-pr.yml @@ -0,0 +1,30 @@ +name: Preview Hugo Site + +on: + pull_request: + branches: + - main + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Hugo + uses: peaceiris/actions-hugo@v3 + with: + hugo-version: '0.120.4' + + - name: Build the site + run: hugo --minify + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./public + # Deploy to a subdirectory for each PR + destination_dir: "preview/${{ github.event.number }}-${{ github.sha }}"