1- # Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
2- # More GitHub Actions for Azure: https://github.com/Azure/actions
3- # More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions
4-
51name : Build and deploy Python app to Azure Web App - ai-dslab-backend
62
73on :
@@ -14,36 +10,29 @@ jobs:
1410 build :
1511 runs-on : ubuntu-latest
1612 permissions :
17- contents : read # This is required for actions/checkout
13+ contents : read
1814
1915 steps :
2016 - uses : actions/checkout@v4
2117
22- - name : Set up Python version
18+ - name : Set up Python
2319 uses : actions/setup-python@v5
2420 with :
2521 python-version : ' 3.10'
2622
27- - name : Create and start virtual environment
28- run : |
29- python -m venv venv
30- source venv/bin/activate
31-
32- - name : Install dependencies
23+ - name : Install dependencies from backend
3324 run : pip install -r backend/requirements.txt
34-
35- # Optional: Add step to run tests here (PyTest, Django test suites, etc.)
3625
37- - name : Zip artifact for deployment
38- run : zip release.zip ./* -r
26+ - name : Zip backend folder for deployment
27+ run : |
28+ cd backend
29+ zip -r ../release.zip . -x "venv/*"
3930
40- - name : Upload artifact for deployment jobs
31+ - name : Upload artifact for deployment
4132 uses : actions/upload-artifact@v4
4233 with :
4334 name : python-app
44- path : |
45- release.zip
46- !venv/
35+ path : release.zip
4736
4837 deploy :
4938 runs-on : ubuntu-latest
5241 name : ' Production'
5342 url : ${{ steps.deploy-to-webapp.outputs.webapp-url }}
5443 permissions :
55- id-token : write # This is required for requesting the JWT
56- contents : read # This is required for actions/checkout
44+ id-token : write
45+ contents : read
5746
5847 steps :
5948 - name : Download artifact from build job
@@ -64,18 +53,17 @@ jobs:
6453 - name : Unzip artifact for deployment
6554 run : unzip release.zip
6655
67-
6856 - name : Login to Azure
6957 uses : azure/login@v2
7058 with :
7159 client-id : ${{ secrets.AZUREAPPSERVICE_CLIENTID_1FAE509EB83D4609AE36AC7F0F996753 }}
7260 tenant-id : ${{ secrets.AZUREAPPSERVICE_TENANTID_1CAD4C5815F74749A836FC494CB56088 }}
7361 subscription-id : ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_BF92A8605B30418D89D037A4530EF5D2 }}
7462
75- - name : ' Deploy to Azure Web App'
63+ - name : Deploy to Azure Web App
7664 uses : azure/webapps-deploy@v3
7765 id : deploy-to-webapp
7866 with :
7967 app-name : ' ai-dslab-backend'
8068 slot-name : ' Production'
81-
69+ package : release.zip
0 commit comments