1- name : Build and Deploy
2- on :
3- push :
4- branches :
5- - main
6- - development
7- concurrency :
8- group : Build and Deploy / ${{ github.ref_name == 'main' && 'Production' || 'Development' }}
9- cancel-in-progress : true
10- jobs :
11- # Build
12- build :
13- name : Build
14- strategy :
15- matrix :
16- environment : ${{ github.ref_name == 'main' && fromJson('["Production", "Beta"]') || fromJson('["Development"]') }}
17- environment : ${{ matrix.environment }}
18- runs-on : ubuntu-latest
19- steps :
20- - name : Checkout Repository
21- uses : actions/checkout@v4
22- - name : Setup Node.js
23- uses : actions/setup-node@v4
24- with :
25- node-version : 20
26- cache : ' yarn'
27- - name : Install Dependencies
28- run : yarn install --frozen-lockfile
29- # We don't run tests here since we assume it's already done during PR process.
30- # - name: Update Browser List
31- # run: npx browserslist@latest --update-db
32- - name : Build React App
33- run : yarn run build && cp build/index.html build/200.html
34- env :
35- NODE_ENV : ${{ github.ref_name == 'main' && 'production' || 'development' }}
36- REACT_APP_APIENDPOINT : ${{ vars.REACT_APP_API_ENDPOINT }}
37- GENERATE_SOURCEMAP : ${{ github.ref_name != 'main' }}
38- - name : Upload Build Artifact
39- uses : actions/upload-artifact@v4
40- with :
41- name : ${{ matrix.environment }} Build
42- path : ./build
43- # Deployment
44- deployment-surge :
45- name : Deploy to Surge
46- needs : build
47- runs-on : ubuntu-latest
48- strategy :
49- matrix :
50- environment : ${{ github.ref_name == 'main' && fromJson('["Production", "Beta"]') || fromJson('["Development"]') }}
51- environment : ${{ matrix.environment }}
52- if : ${{ success() }}
53- steps :
54- - name : Download Build Artifact
55- uses : actions/download-artifact@v4
56- with :
57- name : ${{ matrix.environment }} Build
58- path : ./build
59- - name : Deploy to Surge
60- uses : dswistowski/surge-sh-action@v1
61- with :
62- domain : ${{ vars.SURGE_DOMAIN }}
63- project : ' ./build'
64- login : ${{ secrets.SURGE_LOGIN }}
65- token : ${{ secrets.SURGE_TOKEN }}
1+ name : Build and Deploy
2+ on :
3+ push :
4+ branches :
5+ - main
6+ - development
7+ concurrency :
8+ group : Build and Deploy / ${{ github.ref_name == 'main' && 'Production' || 'Development' }}
9+ cancel-in-progress : true
10+ jobs :
11+ # Build
12+ build :
13+ name : Build
14+ strategy :
15+ matrix :
16+ environment : ${{ github.ref_name == 'main' && fromJson('["Production", "Beta"]') || fromJson('["Development"]') }}
17+ environment : ${{ matrix.environment }}
18+ runs-on : ubuntu-latest
19+ steps :
20+ - name : Checkout Repository
21+ uses : actions/checkout@v4
22+ - name : Setup Node.js
23+ uses : actions/setup-node@v4
24+ with :
25+ node-version : 20
26+ cache : ' yarn'
27+ - name : Install Dependencies
28+ run : yarn install --frozen-lockfile
29+ # We don't run tests here since we assume it's already done during PR process.
30+ # - name: Update Browser List
31+ # run: npx browserslist@latest --update-db
32+ - name : Build React App
33+ run : yarn run build && cp build/index.html build/200.html
34+ env :
35+ NODE_ENV : ${{ github.ref_name == 'main' && 'production' || 'development' }}
36+ REACT_APP_APIENDPOINT : ${{ vars.REACT_APP_API_ENDPOINT }}
37+ GENERATE_SOURCEMAP : ${{ github.ref_name != 'main' }}
38+ - name : Upload Build Artifact
39+ uses : actions/upload-artifact@v4
40+ with :
41+ name : ${{ matrix.environment }} Build
42+ path : ./build
43+ # Deployment
44+ deployment-surge :
45+ name : Deploy to Surge
46+ needs : build
47+ runs-on : ubuntu-latest
48+ strategy :
49+ matrix :
50+ environment : ${{ github.ref_name == 'main' && fromJson('["Production", "Beta"]') || fromJson('["Development"]') }}
51+ environment : ${{ matrix.environment }}
52+ if : ${{ success() }}
53+ steps :
54+ - name : Download Build Artifact
55+ uses : actions/download-artifact@v4
56+ with :
57+ name : ${{ matrix.environment }} Build
58+ path : ./build
59+ - name : Deploy to Surge
60+ uses : dswistowski/surge-sh-action@v1
61+ with :
62+ domain : ${{ vars.SURGE_DOMAIN }}
63+ project : ' ./build'
64+ login : ${{ secrets.SURGE_LOGIN }}
65+ token : ${{ secrets.SURGE_TOKEN }}
0 commit comments