Skip to content

Update master_toomuchtodobackend.yml #8

Update master_toomuchtodobackend.yml

Update master_toomuchtodobackend.yml #8

name: Build and deploy Python app to Azure Web App - TooMuchToDoBackend
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python version
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Create and start virtual environment in backend
run: |
cd backend
python -m venv venv
source venv/bin/activate
- name: Install dependencies in backend
run: |
cd backend
pip install -r requirements.txt
# Step to create the firebase_admin_credentials.json file from the secret
- name: Create Firebase Admin Credentials File
run: |
echo "${{ secrets.FIREBASE_ADMIN_CREDENTIALS }}"
echo "${{ secrets.FIREBASE_ADMIN_CREDENTIALS }}" > backend/firebase_admin_credentials.json
# Optional: Add step to run tests here (PyTest, Django test suites, etc.)
- name: Zip artifact for deployment
run: |
cd backend
zip -r ../release.zip ./*
- name: Upload artifact for deployment jobs
uses: actions/upload-artifact@v4
with:
name: python-app
path: release.zip
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write # This is required for requesting the JWT
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: python-app
- name: Unzip artifact for deployment
run: unzip release.zip
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_5D539624CECF4EFD96ECD3E2631C5906 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_E3CE7B5488DE4657A22AD4580526D618 }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_3EC8E0579058475A84E06B24ADB1FCF8 }}
- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v3
id: deploy-to-webapp
with:
app-name: 'TooMuchToDoBackend'
slot-name: 'Production'