Deploy PR previews #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy PR previews | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- closed | |
workflow_dispatch: | |
concurrency: preview-${{ github.ref }} | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
pull-requests: write | |
jobs: | |
deploy-preview: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.3.5' | |
bundler-cache: true | |
cache-version: 0 # Increment this number if you need to re-download cached gems | |
- name: Regenerate templates | |
run: ./regen.py | |
- name: Build with Jekyll | |
run: bundle exec jekyll build --baseurl "/pr-preview/pr-${{github.event.number}}" | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
- name: Deploy preview | |
uses: rossjrw/pr-preview-action@v1 | |
with: | |
source-dir: ./_site/ | |
preview-branch: gh-pages | |
umbrella-dir: pr-preview |