-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (47 loc) · 1.84 KB
/
Copy pathdeploy.yml
File metadata and controls
56 lines (47 loc) · 1.84 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
name: Deploy
on:
push:
branches: [main]
workflow_dispatch:
inputs:
environment:
description: "Target environment"
required: true
default: "staging"
type: choice
options: [staging, production]
env:
AWS_REGION: us-east-1
ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com
jobs:
deploy:
name: Deploy to ${{ github.event.inputs.environment || 'staging' }}
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment || 'staging' }}
steps:
- uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
- name: Build and push API Gateway
run: |
docker build -t $ECR_REGISTRY/stellar-local-api-gateway:${{ github.sha }} \
-f services/api-gateway/Dockerfile services/api-gateway
docker push $ECR_REGISTRY/stellar-local-api-gateway:${{ github.sha }}
- name: Build and push Web App
run: |
docker build -t $ECR_REGISTRY/stellar-local-web:${{ github.sha }} \
-f apps/web/Dockerfile apps/web
docker push $ECR_REGISTRY/stellar-local-web:${{ github.sha }}
- name: Deploy to EKS
run: |
aws eks update-kubeconfig --name stellar-local-${{ github.event.inputs.environment || 'staging' }}
kubectl set image deployment/api-gateway \
api-gateway=$ECR_REGISTRY/stellar-local-api-gateway:${{ github.sha }} \
-n stellar-local
kubectl rollout status deployment/api-gateway -n stellar-local