-
Notifications
You must be signed in to change notification settings - Fork 2
55 lines (45 loc) · 1.82 KB
/
deploy-server.yml
File metadata and controls
55 lines (45 loc) · 1.82 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
name: Deploy to AWS
on:
workflow_dispatch:
jobs:
build-and-deploy:
name: Build and Deploy
runs-on: ubuntu-latest
environment: production
env:
ECS_CLUSTER: MemChat
ECS_SERVICE: memchat-facilitator-x402
ECR_REPOSITORY: memchat/facilitator-x402
IMAGE_TAG: latest
AWS_REGION: us-east-2
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up 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
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "Docker image successfully pushed to ECR!"
- name: Force new deployment on Amazon ECS
run: |
aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --force-new-deployment > /dev/null
echo "New ECS deployment started!"
- name: AWS LINKS TO VIEW DEPLOYMENT
run: |
echo "View deployment progress here - https://us-east-2.console.aws.amazon.com/ecs/v2/clusters/MemChat/services/facilitator-x402/tasks?region=us-east-2"
- name: Wait for ECS service to stabilize
run: |
echo "Waiting for ECS service to stabilize..."
aws ecs wait services-stable --cluster $ECS_CLUSTER --services $ECS_SERVICE
echo "✅ ECS service is now stable and deployment is complete!"