Skip to content

Commit 8026826

Browse files
authored
Server will deploy on one job in GitHub Action #34 (#46)
1 parent acb4bc0 commit 8026826

File tree

3 files changed

+20
-96
lines changed

3 files changed

+20
-96
lines changed

.github/workflows/dev-deployment.yml

Lines changed: 9 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
build:
10-
name: Build
10+
name: Deploy
1111
runs-on: ubuntu-latest
1212

1313
steps:
@@ -30,59 +30,21 @@ jobs:
3030
tools-version: 13.29.1
3131
firebase_token: ${{ secrets.FIREBASE_TOKEN }}
3232

33-
- name: Generate .env.dev
33+
- name: Generate .env
3434
run: |
3535
cd functions
36-
echo "GOOGLE_MAPS_API_KEY=${{ secrets.GOOGLE_MAPS_API_KEY_DEV }}" >> .env.dev
37-
echo "CORS_ORIGIN=${{ secrets.CORS_ORIGIN_DEV }}" >> .env.dev
38-
echo "MOBILE_API_KEY_SCHEME=${{ secrets.MOBILE_API_KEY_SCHEME_DEV }}" >> .env.dev
39-
echo "MOBILE_API_KEY=${{ secrets.MOBILE_API_KEY_DEV }}" >> .env.dev
36+
echo "GOOGLE_MAPS_API_KEY=${{ secrets.GOOGLE_MAPS_API_KEY_DEV }}" >> .env
37+
echo "CORS_ORIGIN_1=${{ secrets.CORS_ORIGIN_1_DEV }}" >> .env
38+
echo "CORS_ORIGIN_2=${{ secrets.CORS_ORIGIN_2_DEV }}" >> .env
39+
echo "CORS_ORIGIN_3=${{ secrets.CORS_ORIGIN_3_DEV }}" >> .env
40+
echo "MOBILE_API_KEY_SCHEME=${{ secrets.MOBILE_API_KEY_SCHEME_DEV }}" >> .env
41+
echo "MOBILE_API_KEY=${{ secrets.MOBILE_API_KEY_DEV }}" >> .env
4042
4143
- name: Build
4244
run: |
4345
cd functions
4446
npm run build
4547
46-
- name: Archive Production Artifact
47-
uses: actions/upload-artifact@master
48-
with:
49-
name: lib
50-
path: functions/lib
51-
52-
- name: Notify Build End
53-
if: failure()
54-
uses: 8398a7/action-slack@v3
55-
with:
56-
status: ${{ job.status }}
57-
fields: repo,author,ref,took
58-
env:
59-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
60-
61-
deploy:
62-
name: Deploy
63-
needs: build
64-
runs-on: ubuntu-latest
65-
steps:
66-
- name: Checkout
67-
uses: actions/checkout@master
68-
69-
- name: Download Artifact
70-
uses: actions/download-artifact@master
71-
with:
72-
name: lib
73-
path: functions/lib
74-
75-
- name: Install Dependencies
76-
run: |
77-
cd functions
78-
npm install
79-
80-
- name: Setup Firebase Tools
81-
uses: w9jds/setup-firebase@main
82-
with:
83-
tools-version: 13.29.1
84-
firebase_token: ${{ secrets.FIREBASE_TOKEN }}
85-
8648
- name: Select Configuration
8749
run: |
8850
cd functions
@@ -96,6 +58,6 @@ jobs:
9658
uses: 8398a7/action-slack@v3
9759
with:
9860
status: ${{ job.status }}
99-
fields: repo,author,ref,took
61+
fields: repo,author,ref
10062
env:
10163
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release to Production
1+
name: Deploy to Production
22

33
on:
44
push:
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
build:
10-
name: Build
10+
name: Deploy
1111
runs-on: ubuntu-latest
1212

1313
steps:
@@ -30,59 +30,21 @@ jobs:
3030
tools-version: 13.29.1
3131
firebase_token: ${{ secrets.FIREBASE_TOKEN }}
3232

33-
- name: Generate .env.prod
33+
- name: Generate .env
3434
run: |
3535
cd functions
36-
echo "GOOGLE_MAPS_API_KEY=${{ secrets.GOOGLE_MAPS_API_KEY }}" >> .env.prod
37-
echo "CORS_ORIGIN=${{ secrets.CORS_ORIGIN }}" >> .env.prod
38-
echo "MOBILE_API_KEY_SCHEME=${{ secrets.MOBILE_API_KEY_SCHEME }}" >> .env.prod
39-
echo "MOBILE_API_KEY=${{ secrets.MOBILE_API_KEY }}" >> .env.prod
36+
echo "GOOGLE_MAPS_API_KEY=${{ secrets.GOOGLE_MAPS_API_KEY }}" >> .env
37+
echo "CORS_ORIGIN_1=${{ secrets.CORS_ORIGIN_1 }}" >> .env
38+
echo "CORS_ORIGIN_2=${{ secrets.CORS_ORIGIN_2 }}" >> .env
39+
echo "CORS_ORIGIN_3=${{ secrets.CORS_ORIGIN_3 }}" >> .env
40+
echo "MOBILE_API_KEY_SCHEME=${{ secrets.MOBILE_API_KEY_SCHEME }}" >> .env
41+
echo "MOBILE_API_KEY=${{ secrets.MOBILE_API_KEY }}" >> .env
4042
4143
- name: Build
4244
run: |
4345
cd functions
4446
npm run build
4547
46-
- name: Archive Production Artifact
47-
uses: actions/upload-artifact@master
48-
with:
49-
name: lib
50-
path: functions/lib
51-
52-
- name: Notify Build End
53-
if: failure()
54-
uses: 8398a7/action-slack@v3
55-
with:
56-
status: ${{ job.status }}
57-
fields: repo,author,ref,took
58-
env:
59-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
60-
61-
deploy:
62-
name: Deploy
63-
needs: build
64-
runs-on: ubuntu-latest
65-
steps:
66-
- name: Checkout
67-
uses: actions/checkout@master
68-
69-
- name: Download Artifact
70-
uses: actions/download-artifact@master
71-
with:
72-
name: lib
73-
path: functions/lib
74-
75-
- name: Install Dependencies
76-
run: |
77-
cd functions
78-
npm install
79-
80-
- name: Setup Firebase Tools
81-
uses: w9jds/setup-firebase@main
82-
with:
83-
tools-version: 13.29.1
84-
firebase_token: ${{ secrets.FIREBASE_TOKEN }}
85-
8648
- name: Select Configuration
8749
run: |
8850
cd functions
@@ -96,6 +58,6 @@ jobs:
9658
uses: 8398a7/action-slack@v3
9759
with:
9860
status: ${{ job.status }}
99-
fields: repo,author,ref,took
61+
fields: repo,author,ref
10062
env:
10163
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

functions/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { WrappingResponse } from "@shared/middleware";
1111
const cors = require('cors')
1212

1313
const corsOptions = {
14-
origin: process.env.CORS_ORIGIN,
14+
origin: [process.env.CORS_ORIGIN_1, process.env.CORS_ORIGIN_2, process.env.CORS_ORIGIN_3],
1515
methods: ['GET', 'POST', 'PUT', 'DELETE'],
1616
}
1717

0 commit comments

Comments
 (0)