-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (60 loc) · 2.03 KB
/
main_hodlbot-api.yml
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
name: Deploy FastAPI Backend to Azure
on:
push:
branches:
- main
paths:
- '**/*' # Trigger on changes anywhere (or adjust as needed)
workflow_dispatch: # Allows manual triggering from GitHub Actions UI
jobs:
backend-deploy:
name: Deploy FastAPI Backend
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Verify Checkout
run: ls -la || exit 1
- name: Log in to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Verify Azure Login
run: az account show || exit 1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Verify Python Setup
run: python --version || exit 1
- name: Install Dependencies
run: |
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
echo "✅ Dependencies installed"
- name: Verify Dependencies Installation
run: |
source .venv/bin/activate
pip list || exit 1
- name: Oryx Opt Out
run: |
echo "SCM_DO_BUILD_DURING_DEPLOYMENT=false" >> .env
- name: ZIP the Application
run: |
# Zip the entire repository (excluding git files, the local venv, caches, etc.)
zip -r backend.zip . -x "*.git*" "*.venv/*" "__pycache__/*" "*.DS_Store"
- name: Verify ZIP File Creation
run: ls -lh backend.zip || exit 1
- name: Deploy FastAPI Backend to Azure App Service
uses: azure/webapps-deploy@v2
with:
app-name: "hodlbot-api"
slot-name: "production"
package: "backend.zip"
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
- name: Verify Deployment
run: |
sleep 10 # Allow some time for deployment
curl -f hodlbot-api-bmcmdhccf5hmgahy.eastus2-01.azurewebsites.net || exit 1