Skip to content

Commit 519c244

Browse files
authored
Create ci-cd.yml
1 parent 44b73ae commit 519c244

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/ci-cd.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Vial MCP CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.11'
20+
- name: Install dependencies
21+
run: |
22+
pip install -r main/api/mcp/requirements.txt
23+
- name: Run tests
24+
run: |
25+
cd main/api/mcp
26+
pytest tests/
27+
- name: Lint frontend
28+
run: |
29+
cd main/frontend
30+
npm install
31+
npm run lint
32+
33+
deploy:
34+
runs-on: ubuntu-latest
35+
needs: test
36+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
37+
steps:
38+
- uses: actions/checkout@v3
39+
- name: Log in to AWS ECR
40+
uses: aws-actions/amazon-ecr-login@v1
41+
with:
42+
registry-ids: ${{ secrets.AWS_ACCOUNT_ID }}
43+
region: ${{ secrets.AWS_REGION }}
44+
- name: Build and push backend image
45+
run: |
46+
docker build -t vial-mcp-backend ./main/api
47+
docker tag vial-mcp-backend:latest ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/vial-mcp-backend:latest
48+
docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/vial-mcp-backend:latest
49+
- name: Build and push frontend image
50+
run: |
51+
docker build -t vial-mcp-frontend ./main/frontend
52+
docker tag vial-mcp-frontend:latest ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/vial-mcp-frontend:latest
53+
docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/vial-mcp-frontend:latest
54+
- name: Deploy to ECS
55+
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
56+
with:
57+
task-definition: main/api/task-definition.json
58+
service: vial-mcp-backend
59+
cluster: vial-mcp-cluster
60+
wait-for-service-stability: true
61+
region: ${{ secrets.AWS_REGION }}
62+
- name: Deploy frontend to ECS
63+
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
64+
with:
65+
task-definition: main/frontend/task-definition.json
66+
service: vial-mcp-frontend
67+
cluster: vial-mcp-cluster
68+
wait-for-service-stability: true
69+
region: ${{ secrets.AWS_REGION }}

0 commit comments

Comments
 (0)