-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (68 loc) · 2.16 KB
/
Copy pathdeploy.yml
File metadata and controls
85 lines (68 loc) · 2.16 KB
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
name: Build, Migrate, & Deploy (prod)
on:
push:
branches: [ "main" ]
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
ECR_REPO: ${{ secrets.ECR_REPO }}
EC2_INSTANCE_ID: ${{ secrets.EC2_INSTANCE_ID }}
CONTAINER_NAME: ${{ secrets.CONTAINER_NAME }}
LOG_GROUP_NAME: ${{ secrets.LOG_GROUP_NAME}}
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS credentials with OIDC
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to ECR
uses: aws-actions/amazon-ecr-login@v2
- name: Build & push images
env:
GITHUB_SHA: ${{ github.sha }}
run: bash ./scripts/ci/build_and_push.sh
migrate:
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS credentials with OIDC
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Run Migrations via SSM
env:
GITHUB_SHA: ${{ github.sha }}
run: bash ./scripts/ci/migrate_via_ssm.sh
deploy:
runs-on: ubuntu-latest
needs: [build, migrate]
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS credentials with OIDC
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Deploy to EC2 via SSM
env:
GITHUB_SHA: ${{ github.sha }}
run: bash ./scripts/ci/deploy_via_ssm.sh
- name: Verify health
run: bash ./scripts/ci/health_check.sh