From b795faaeaf3fa056c77235c1c016c9eadfad25a7 Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Sat, 6 Jul 2024 23:30:11 +0800 Subject: [PATCH] feat: add workflow to preview prs --- .github/workflows/preview-pr.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/preview-pr.yml diff --git a/.github/workflows/preview-pr.yml b/.github/workflows/preview-pr.yml new file mode 100644 index 000000000..b8aeb8a95 --- /dev/null +++ b/.github/workflows/preview-pr.yml @@ -0,0 +1,32 @@ +name: Preview Hugo Site + +on: + pull_request: + branches: + - main + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Set up Hugo + uses: peaceiris/actions-hugo@v3 + with: + hugo-version: '0.120.4' + + - name: Check out repo + uses: actions/checkout@v4 + with: + submodules: recursive + + - 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 }}"