File tree 1 file changed +19
-3
lines changed
1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change 1
1
name : Preview Deployment
2
2
3
3
on :
4
+ push :
5
+ branches :
6
+ - main
4
7
pull_request :
5
8
types : [opened, synchronize, labeled]
6
9
@@ -10,14 +13,15 @@ concurrency:
10
13
11
14
jobs :
12
15
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' }}
14
17
runs-on : ubuntu-latest
15
18
concurrency :
16
19
group : netlify
17
20
cancel-in-progress : false
18
21
env :
19
22
REPO_ACCESS_TOKEN : ${{ secrets.REPO_ACCESS_TOKEN }}
20
23
APP_ENV : prod
24
+ BRANCH_NAME : ${{ github.ref_name }}
21
25
22
26
steps :
23
27
@@ -83,17 +87,29 @@ jobs:
83
87
- name : Install Netlify
84
88
run :
npm install [email protected] -g
85
89
86
- - name : Deploy to Netlify
87
- id : netlify_deploy
90
+ - name : Deploy to Netlify Preview
91
+ if : github.event_name == 'pull_request'
92
+ run : |
93
+ netlify deploy \
94
+ --dir public \
95
+ --site ${{ secrets.NETLIFY_SITE_ID }} \
96
+ --auth ${{ secrets.NETLIFY_AUTH_TOKEN }} \
97
+ --json \
98
+ > deploy_output.json
99
+
100
+ - name : Deploy to Netlify Prod
101
+ if : github.event_name != 'pull_request'
88
102
run : |
89
103
netlify deploy \
104
+ --prod \
90
105
--dir public \
91
106
--site ${{ secrets.NETLIFY_SITE_ID }} \
92
107
--auth ${{ secrets.NETLIFY_AUTH_TOKEN }} \
93
108
--json \
94
109
> deploy_output.json
95
110
96
111
- name : Generate URL Preview
112
+ if : github.event_name == 'pull_request'
97
113
id : url_preview
98
114
run : |
99
115
NETLIFY_PREVIEW_URL=$(jq -r '.deploy_url' deploy_output.json)
You can’t perform that action at this time.
0 commit comments