Skip to content

Commit 6bec04e

Browse files
Merge pull request #10 from acmucsd/try-preview-deploys
Try preview deploys on PR
2 parents edc593c + caf086e commit 6bec04e

File tree

3 files changed

+39
-17
lines changed

3 files changed

+39
-17
lines changed
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# .github/workflows/preview.yml
2+
name: Deploy PR previews
3+
4+
on:
5+
pull_request:
6+
types:
7+
- opened
8+
- reopened
9+
- synchronize
10+
- closed
11+
12+
concurrency: preview-${{ github.ref }}
13+
14+
jobs:
15+
deploy-preview:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Install and Build
22+
if: github.event.action != 'closed' # You might want to skip the build if the PR has been closed
23+
run: |
24+
npm install
25+
npm run build-storybook
26+
27+
- name: Deploy preview
28+
uses: rossjrw/pr-preview-action@v1
29+
with:
30+
source-dir: ./storybook-static/
31+
preview-branch: gh-pages

.github/workflows/gh-pages.yml

+6-16
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ concurrency:
2323

2424
jobs:
2525
# Build job
26-
build:
26+
deploy:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- name: Checkout
@@ -34,19 +34,9 @@ jobs:
3434
run: |
3535
npm install
3636
npm run build-storybook
37-
- name: Upload artifact
38-
uses: actions/upload-pages-artifact@v3
37+
- uses: JamesIves/github-pages-deploy-action@v4
3938
with:
40-
path: storybook-static/
41-
42-
# Deployment job
43-
deploy:
44-
environment:
45-
name: github-pages
46-
url: ${{ steps.deployment.outputs.page_url }}
47-
runs-on: ubuntu-latest
48-
needs: build
49-
steps:
50-
- name: Deploy to GitHub Pages
51-
id: deployment
52-
uses: actions/deploy-pages@v4
39+
folder: ./storybook-static/
40+
branch: gh-pages
41+
clean-exclude: pr-preview
42+
force: false

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ node_modules
22
.cache
33
.next
44
storybook-static
5-
dist
5+
dist
6+
package-lock.json

0 commit comments

Comments
 (0)