-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (59 loc) · 1.92 KB
/
pipeline-aws.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
name: AWS Lambda CI/CD
on:
push:
branches:
- 'main'
- 'release/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run tests
run:
docker run --rm -t -v ${PWD}:/app --env-file configs/.env.development -w /app --network=host python:3.8-alpine sh -c 'pip install --upgrade pip -r requirements.txt && python3 -m unittest discover test "*Test.py"'
deploy-staging:
if: contains(github.ref, 'refs/heads/release')
needs: build
runs-on: ubuntu-latest
environment: staging
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16.x'
- name: Install Node.js dependencies
run: npm install
- name: Configure staging AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: sa-east-1
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
- name: Serverless deploy
run: npm run-script deploy-staging
deploy-production:
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16.x'
- name: Install Node.js dependencies
run: npm install
- name: Configure production AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: sa-east-1
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Serverless deploy
run: npm run-script deploy-production