Skip to content

Commit 62b1a79

Browse files
committed
chore: Add preview step to GitHub Pages deployment workflow
1 parent 6f9c9fd commit 62b1a79

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/build.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,34 @@ jobs:
6464
path: public
6565
name: public
6666

67+
preview:
68+
name: Preview when PR exists branch
69+
runs-on: ubuntu-latest
70+
needs: build
71+
if: github.event_name == 'pull_request' && github.event.action != 'closed'
72+
steps:
73+
- name: Check out the repo
74+
uses: actions/checkout@v4
75+
with:
76+
fetch-depth: 0
77+
78+
- name: Get artifacts from build job
79+
uses: actions/download-artifact@v4
80+
with:
81+
name: public
82+
path: public
83+
84+
- uses: actions/upload-pages-artifact@v3
85+
with:
86+
path: public
87+
name: pages
88+
89+
- name: Deploy to GitHub Pages
90+
uses: actions/deploy-pages@v4
91+
with:
92+
artifact_name: pages
93+
preview: true
94+
6795
deploy:
6896
if: github.ref == 'refs/heads/main'
6997
needs: build

0 commit comments

Comments
 (0)