Skip to content

Add GitHub workflows for deployment #1

Add GitHub workflows for deployment

Add GitHub workflows for deployment #1

Workflow file for this run

name: Deploy FastAPI to Azure Functions
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install Azure CLI
run: |
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
- name: Log in to Azure
run: az login --service-principal -u ${{ secrets.AZURE_CREDENTIALS }}
- name: Deploy to Azure Functions
run: |
az functionapp deployment source config-zip \
--resource-group <your-resource-group> \
--name ${{ secrets.AZURE_FUNCTIONAPP_NAME }} \
--src function_app.zip
env:
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
- name: Clean up
run: |
rm function_app.zip