Skip to content

Commit ff919f9

Browse files
committed
Add preview deployment
1 parent eefc0ea commit ff919f9

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

.github/workflows/page.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ name: Deploy example page
33
on:
44
push:
55
branches: [main]
6+
pull_request:
7+
branches: [main]
68

79
jobs:
8-
build:
10+
Build:
911
runs-on: ubuntu-latest
1012

1113
steps:
@@ -44,20 +46,41 @@ jobs:
4446
with:
4547
path: examples/sandbox/dist
4648

47-
deploy:
48-
needs: build
49+
Deploy:
50+
needs: Build
51+
name: Deploy to Production env
4952
runs-on: ubuntu-latest
53+
if: ${{ github.event_name == 'push' }}
5054

5155
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
5256
permissions:
5357
pages: write # to deploy to Pages
5458
id-token: write # to verify the deployment originates from an appropriate source
5559

5660
environment:
57-
name: github-pages
61+
name: Production
5862
url: ${{ steps.deployment.outputs.page_url }}
5963

6064
steps:
6165
- name: Deploy to GitHub Pages
6266
id: deployment
6367
uses: actions/deploy-pages@v4
68+
69+
Deploy_Preview:
70+
needs: Build
71+
name: Deploy to Preview env
72+
runs-on: ubuntu-latest
73+
if: ${{ github.event_name == 'pull_request' }}
74+
75+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
76+
permissions:
77+
pages: write # to deploy to Pages
78+
id-token: write # to verify the deployment originates from an appropriate source
79+
80+
environment:
81+
name: Preview
82+
83+
steps:
84+
- name: Deploy to GitHub Pages
85+
id: deployment
86+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)