Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 38c96a2

Browse filesBrowse files
committed
fixup! Adding preview also for main branch
1 parent 5ea3756 commit 38c96a2
Copy full SHA for 38c96a2

File tree

Expand file treeCollapse file tree

1 file changed

+15
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-4
lines changed

‎.github/workflows/preview.yml

Copy file name to clipboardExpand all lines: .github/workflows/preview.yml
+15-4Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,31 @@ jobs:
8787
- name: Install Netlify
8888
run: npm install netlify-cli@17.23.2 -g
8989

90-
- name: Deploy to Netlify
90+
- name: Deploy to Netlify Preview
91+
if: github.event_name == 'pull_request'
9192
id: netlify_deploy
9293
run: |
93-
prod_flag=""
94-
if [ "$BRANCH_NAME" = "main" ]; then prod_flag="--prod"; fi
9594
netlify deploy \
9695
--dir public \
9796
--site ${{ secrets.NETLIFY_SITE_ID }} \
9897
--auth ${{ secrets.NETLIFY_AUTH_TOKEN }} \
99-
$prod_flag \
98+
--json \
99+
> deploy_output.json
100+
101+
- name: Deploy to Netlify Prod
102+
if: github.event_name != 'pull_request'
103+
id: netlify_deploy
104+
run: |
105+
netlify deploy \
106+
--prod \
107+
--dir public \
108+
--site ${{ secrets.NETLIFY_SITE_ID }} \
109+
--auth ${{ secrets.NETLIFY_AUTH_TOKEN }} \
100110
--json \
101111
> deploy_output.json
102112
103113
- name: Generate URL Preview
114+
if: github.event_name == 'pull_request'
104115
id: url_preview
105116
run: |
106117
NETLIFY_PREVIEW_URL=$(jq -r '.deploy_url' deploy_output.json)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.