Fixing Typos in main.py #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy FastAPI Backend to Azure | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**/*' # Trigger on changes anywhere | |
workflow_dispatch: # Allows manual triggering from GitHub Actions UI | |
jobs: | |
backend-deploy: | |
name: Deploy FastAPI Backend | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout Code | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# Step 2: Verify Checkout | |
- name: Verify Checkout | |
run: ls -la || exit 1 | |
# Step 3: Log in to Azure | |
- name: Log in to Azure | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
# Step 4: Verify Azure Login | |
- name: Verify Azure Login | |
run: az account show || exit 1 | |
# Step 5: Set up Python | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
# Step 6: Verify Python Setup | |
- name: Verify Python Setup | |
run: python --version || exit 1 | |
# Step 7: Install Dependencies | |
- name: Install Dependencies | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
echo "✅ Dependencies installed" | |
# Step 8: Verify Dependencies Installation | |
- name: Verify Dependencies Installation | |
run: | | |
source .venv/bin/activate | |
pip list || exit 1 | |
# Step 9: Set SCM_DO_BUILD_DURING_DEPLOYMENT | |
- name: Disable Oryx Build | |
run: | | |
echo "SCM_DO_BUILD_DURING_DEPLOYMENT=false" > .env | |
# Step 10: Create a ZIP Package | |
- name: ZIP the Application | |
run: | | |
zip -r backend.zip . -x "*.git*" "*.venv/*" "__pycache__/*" "*.DS_Store" | |
# Step 11: Verify ZIP File Creation | |
- name: Verify ZIP File Creation | |
run: ls -lh backend.zip || exit 1 | |
# Step 12: Deploy to Azure App Service | |
- name: Deploy FastAPI Backend to Azure App Service | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: "hodlbot-api" | |
package: "backend.zip" | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
# Step 13: Verify Deployment with a Test Request | |
- name: Verify Deployment | |
run: | | |
sleep 10 # Wait for deployment to complete | |
curl -f https://hodlbot-api-bmcmdhccf5hmgahy.eastus2-01.azurewebsites.net || exit 1 |