Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy PR Preview

on:
pull_request:
types: [opened, reopened, synchronize, closed]

concurrency: preview-${{ github.ref }}

jobs:
deploy-preview:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout Code
uses: actions/checkout@v4

# Set up Ruby and cache gems for faster builds
- name: Set up Ruby
if: github.event.action != 'closed'
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2' # Match your local Ruby version
bundler-cache: true

# Compile Jekyll with a custom baseurl pointing to the preview folder
- name: Build Jekyll Site
if: github.event.action != 'closed'
run: |
bundle install
bundle exec jekyll build --baseurl "/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.number }}"

# Deploy the compiled static folder to GitHub Pages
- name: Deploy PR Preview to GitHub Pages
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./_site # Default output folder for Jekyll
preview-branch: gh-pages # The branch your live GitHub Pages site serves from
umbrella-dir: pr-preview # Parent folder for previews on the gh-pages branch
action: auto
Loading