Skip to content

Commit 04a4a66

Browse files
committed
Adding preview also for main branch
1 parent 960dba9 commit 04a4a66

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/preview.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Preview Deployment
22

33
on:
4+
push:
5+
branches:
6+
- main
47
pull_request:
58
types: [opened, synchronize, labeled]
69

@@ -10,14 +13,15 @@ concurrency:
1013

1114
jobs:
1215
run:
13-
if: contains(github.event.pull_request.labels.*.name, 'preview')
16+
if: contains(github.event.pull_request.labels.*.name, 'preview') || ${{ github.ref_name == 'main' }}
1417
runs-on: ubuntu-latest
1518
concurrency:
1619
group: netlify
1720
cancel-in-progress: false
1821
env:
1922
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
2023
APP_ENV: prod
24+
BRANCH_NAME: ${{ github.ref_name }}
2125

2226
steps:
2327

@@ -86,11 +90,14 @@ jobs:
8690
- name: Deploy to Netlify
8791
id: netlify_deploy
8892
run: |
93+
prod_flag=""
94+
if [ "$BRANCH_NAME" = "main" ]; then prod_flag="--prod"; fi
8995
netlify deploy \
9096
--dir public \
9197
--site ${{ secrets.NETLIFY_SITE_ID }} \
9298
--auth ${{ secrets.NETLIFY_AUTH_TOKEN }} \
9399
--json \
100+
$prod_flag \
94101
> deploy_output.json
95102
96103
- name: Generate URL Preview

0 commit comments

Comments
 (0)