Skip to content

Commit

Permalink
ci: add gh pages PR preview action
Browse files Browse the repository at this point in the history
This commit adds a GitHub pages preview actions allowing users to see
their PR changes live on a preview URL.
  • Loading branch information
rickstaa committed Feb 1, 2024
1 parent 8f2bc53 commit 8f2b325
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/jekyll-gh-pages-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy GitHub pages PR preview

on:
pull_request:
branches: ["main"]

permissions:
contents: read
pages: write
id-token: write
pull-requests: write

concurrency:
group: "preview-${{ github.head_ref }}"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: ./_site

preview:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: github-pages
path: ./_site
- name: Deploy PR Preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./_site
token: ${{ secrets.FORK_TOKEN }}

0 comments on commit 8f2b325

Please sign in to comment.