name: Deploy Backend to Azure on: push: branches: [main] paths: - "backend/**" - ".github/workflows/deploy-backend.yml" workflow_dispatch: permissions: id-token: write contents: read jobs: build-and-deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Python 3.12 uses: actions/setup-python@v5 with: python-version: "3.12" - name: Install dependencies and create package run: | cd backend pip install -r requirements.txt --target=".python_packages/lib/site-packages" zip -r ../deploy.zip . -x ".venv/*" ".env" "__pycache__/*" "*.pyc" ".git/*" "tests/*" - name: Login to Azure uses: azure/login@v2 with: client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_E361D63054AD449285A5D65AA4425533 }} tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_62D66D4E65AC4A6C872064AD668AC691 }} subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_5D7B0564A55F4209A91149F2642D3F69 }} - name: Configure startup command run: | az webapp config set \ --name soc-backend \ --resource-group Operation \ --startup-file startup.sh - name: Deploy to Azure Web App uses: azure/webapps-deploy@v3 with: app-name: soc-backend package: deploy.zip