109 lines (96 loc) · 2.89 KB
/
deploy_aws_api_infrastructure_dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Deploy AWS API Infrastructure
on:
push:
branches:
- main
paths:
- 'api/awsauth/**'
workflow_dispatch:
inputs:
deploy_to_prod:
description: 'If "true" will run full CI pipeline and deploy to prod'
default: "false"
defaults:
run:
working-directory: api/awsauth/
env:
COVID_DATA_MODEL_REF: ${{ github.head_ref }}
jobs:
DeployDev:
environment:
name: dev
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: '${{env.COVID_DATA_MODEL_REF}}'
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install python requirements
run: pip install -r requirements_test.txt -r requirements.txt
- name: Install Serverless Framework and NPM dependencies
run: |
npm install -g serverless@2.72.3
npm install
- name: Deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
DOTENV: ${{ secrets.DOTENV }}
AWS_REGION: us-east-1
API_URL: https://api-dev.covidactnow.org/v2
run: tools/deploy-api-infrastructure.sh dev
TestDev:
if: github.event.inputs.deploy_to_prod == 'true'
needs: [DeployDev]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: '${{env.COVID_DATA_MODEL_REF}}'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: '3.10'
- name: Install test requirements
run: pip install -r requirements_test.txt
- name: Run tests
run: pytest end_to_end_test.py
DeployProd:
if: github.event.inputs.deploy_to_prod == 'true'
needs: [TestDev]
environment:
name: prod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: '${{env.COVID_DATA_MODEL_REF}}'
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.10'
- name: Install python requirements
run: pip install -r requirements_test.txt -r requirements.txt
- name: Install Serverless Framework and NPM dependencies
run: |
npm install -g serverless@2.72.3
npm install
- name: Deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
DOTENV: ${{ secrets.DOTENV }}
AWS_REGION: us-east-1
API_URL: https://api.covidactnow.org/v2
run: tools/deploy-api-infrastructure.sh prod