Skip to content

Commit

Permalink
fixup! Adding preview also for main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
lukdog committed May 9, 2024
1 parent 5ea3756 commit 38c96a2
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,31 @@ jobs:
- name: Install Netlify
run: npm install [email protected] -g

- name: Deploy to Netlify
- name: Deploy to Netlify Preview
if: github.event_name == 'pull_request'
id: netlify_deploy
run: |
prod_flag=""
if [ "$BRANCH_NAME" = "main" ]; then prod_flag="--prod"; fi
netlify deploy \
--dir public \
--site ${{ secrets.NETLIFY_SITE_ID }} \
--auth ${{ secrets.NETLIFY_AUTH_TOKEN }} \
$prod_flag \
--json \
> deploy_output.json
- name: Deploy to Netlify Prod
if: github.event_name != 'pull_request'
id: netlify_deploy
run: |
netlify deploy \
--prod \
--dir public \
--site ${{ secrets.NETLIFY_SITE_ID }} \
--auth ${{ secrets.NETLIFY_AUTH_TOKEN }} \
--json \
> deploy_output.json
- name: Generate URL Preview
if: github.event_name == 'pull_request'
id: url_preview
run: |
NETLIFY_PREVIEW_URL=$(jq -r '.deploy_url' deploy_output.json)
Expand Down

0 comments on commit 38c96a2

Please sign in to comment.