Skip to content

Commit

Permalink
feat: add workflow to preview prs
Browse files Browse the repository at this point in the history
  • Loading branch information
f-hollow committed Jul 6, 2024
1 parent e595b4d commit dd05358
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/preview-pr.yml
Original file line number Diff line number Diff line change
@@ -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 }}"

0 comments on commit dd05358

Please sign in to comment.