Skip to content

Commit

Permalink
ci: add pull request previews
Browse files Browse the repository at this point in the history
Introduces pull request previews using `rossjrw/pr-preview-action`. This new workflow enables us to
review both visual and functional changes before merging.

The preview functionality work in the following manner:

1. **Triggering a Preview**: Whenever a pull request is either opened, re-opened, or updated, the
   contents of the `public` directory are copied under `pr-preview/pr-${github.ref}` located in the
   `gh-pages` branch.

2. **Cleaning Up**: Once a pull request is closed, the corresponding preview folder (specific to the
   closed pull request) is deleted.
  • Loading branch information
jboix committed Feb 20, 2024
1 parent da5d0f8 commit 7d1684e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/github-page.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Github Page

on:
push:
branches:
- main

jobs:
github-page:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Deploy GitHub Page 🚀
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
branch: gh-pages
folder: public
force: false
clean-exclude: pr-preview/
25 changes: 25 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Deploy PR previews

on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed

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

jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Deploy Preview 🚀
uses: rossjrw/pr-preview-action@v1
with:
source-dir: public
preview-branch: gh-pages
umbrella-dir: pr-preview

0 comments on commit 7d1684e

Please sign in to comment.