22# More GitHub Actions for Azure: https://github.com/Azure/actions
33# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions
44
5- name : Build and deploy Python app to Azure Web App - jurisfind-app
5+ name : Build and deploy JurisFind API to Azure Web App
66
77on :
88 push :
99 branches :
1010 - main
11+ paths :
12+ - ' api/**' # Only trigger when API folder changes
1113 workflow_dispatch :
1214
1315jobs :
1416 build :
1517 runs-on : ubuntu-latest
1618 permissions :
17- contents : read # This is required for actions/checkout
19+ contents : read
1820
1921 steps :
2022 - uses : actions/checkout@v4
@@ -26,46 +28,60 @@ jobs:
2628
2729 - name : Create and start virtual environment
2830 run : |
31+ cd api
2932 python -m venv venv
3033 source venv/bin/activate
3134
3235 - name : Install dependencies
33- run : pip install -r requirements.txt
36+ run : |
37+ cd api
38+ pip install -r requirements.txt
3439
35- # Optional: Add step to run tests here (PyTest, Django test suites, etc.)
40+ # Optional: Add step to run tests here
41+ - name : Test Azure connection
42+ run : |
43+ cd api
44+ echo "Testing imports..."
45+ python -c "import fastapi, azure.storage.blob; print('✅ Dependencies OK')"
3646
3747 - name : Upload artifact for deployment jobs
3848 uses : actions/upload-artifact@v4
3949 with :
4050 name : python-app
4151 path : |
42- .
43- !venv/
52+ api/
53+ !api/venv/
54+ !api/__pycache__/
55+ !api/**/__pycache__/
4456
4557 deploy :
4658 runs-on : ubuntu-latest
4759 needs : build
48- permissions :
49- id-token : write # This is required for requesting the JWT
50- contents : read # This is required for actions/checkout
60+ environment :
61+ name : ' Production'
62+ url : ${{ steps.deploy-to-webapp.outputs.webapp-url }}
63+ permissions :
64+ id-token : write
65+ contents : read
5166
5267 steps :
5368 - name : Download artifact from build job
5469 uses : actions/download-artifact@v4
5570 with :
5671 name : python-app
57-
58- - name : Login to Azure
59- uses : azure/login@v2
60- with :
61- client-id : ${{ secrets.AZUREAPPSERVICE_CLIENTID_4BC0FD0403AC4B57B2ACD52482598228 }}
62- tenant-id : ${{ secrets.AZUREAPPSERVICE_TENANTID_665B9D12BF6F49D5BB2D604FC3E837EF }}
63- subscription-id : ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_F46C281934A441D99F06B0919D4CD4AC }}
72+
73+ - name : Login to Azure
74+ uses : azure/login@v2
75+ with :
76+ client-id : ${{ secrets.AZUREAPPSERVICE_CLIENTID_4BC0FD0403AC4B57B2ACD52482598228 }}
77+ tenant-id : ${{ secrets.AZUREAPPSERVICE_TENANTID_665B9D12BF6F49D5BB2D604FC3E837EF }}
78+ subscription-id : ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_F46C281934A441D99F06B0919D4CD4AC }}
6479
6580 - name : ' Deploy to Azure Web App'
6681 uses : azure/webapps-deploy@v3
6782 id : deploy-to-webapp
6883 with :
6984 app-name : ' jurisfind-app'
7085 slot-name : ' Production'
86+ startup-command : ' cd /home/site/wwwroot && chmod +x start.sh && ./start.sh'
7187
0 commit comments