-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (101 loc) · 3.32 KB
/
deploy.yml
File metadata and controls
118 lines (101 loc) · 3.32 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Deploy Weather Center Chat
on:
push:
branches: [ deploy ]
env:
PYTHON_VERSION: '3.12'
NODE_VERSION: '18'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Docker image (Nginx + FastAPI)
run: |
docker build -t weather-center-chat:ci .
- name: Save Docker image as artifact
run: |
docker save weather-center-chat:ci -o image.tar
- name: Upload image artifact
uses: actions/upload-artifact@v4
with:
name: app-image
path: image.tar
test:
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download image artifact
uses: actions/download-artifact@v4
with:
name: app-image
path: .
- name: Load Docker image
run: |
docker load -i image.tar
- name: Run container
run: |
docker run -d --name app -p 8080:80 \
-e VISUAL_CROSSING_API_KEY='${{ secrets.VISUAL_CROSSING_API_KEY }}' \
-e GOOGLE_API_KEY='${{ secrets.GOOGLE_API_KEY }}' \
-e MODEL='gemini-2.0-flash' \
-e DISABLE_WEB_DRIVER='0' \
-e ENVIRONMENT='production' \
weather-center-chat:ci
- name: Wait for health via Nginx
run: |
for i in {1..120}; do
if curl -fsS http://localhost:8080/api/health >/dev/null; then echo "nginx+backend up"; exit 0; fi
sleep 1
done
echo "service not ready"; docker logs app || true; exit 1
- name: Set up Python (for client tests)
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install uv (official installer)
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Sync backend deps for requests
run: |
cd backend
uv sync
- name: Run test_local.py against Nginx
run: |
BACKEND_BASE_URL=http://localhost:8080 uv run --directory backend python ../test_local.py
env:
VISUAL_CROSSING_API_KEY: ${{ secrets.VISUAL_CROSSING_API_KEY }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
- name: Teardown container
if: always()
run: |
docker logs app || true
docker rm -f app || true
render_deploy:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/deploy'
steps:
- uses: actions/checkout@v4
- name: Deploy to Render (Manual)
run: |
echo "Deployment to Render should be configured in Render dashboard"
echo "Environment variables are available in GitHub Secrets:"
echo ""
echo "Backend variables:"
echo "- VISUAL_CROSSING_API_KEY: ${{ secrets.VISUAL_CROSSING_API_KEY != '' }}"
echo "- GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY != '' }}"
- name: Notify deployment status
run: |
echo "✅ Tests passed and deployment is ready"
echo "📋 Next steps:"
echo "1. Go to Render.com dashboard"
echo "2. Create new Web Service from this repository"
echo "3. Use Docker deployment with render.yaml"
echo "4. Set environment variables:"
echo " Backend:"
echo " - VISUAL_CROSSING_API_KEY"
echo " - GOOGLE_API_KEY"
echo "5. Deploy!"