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-
5- name : Build and deploy Python app to Azure Web App - EOAgriTool
6-
7- on :
8- push :
9- branches :
10- - main
11- workflow_dispatch :
12-
13- jobs :
14- build :
15- runs-on : ubuntu-latest
16- permissions :
17- contents : read # This is required for actions/checkout
18-
19- steps :
20- - uses : actions/checkout@v4
21-
22- - name : Set up Python version
23- uses : actions/setup-python@v5
24- with :
25- python-version : ' 3.9'
26-
27- - name : Create and start virtual environment
28- run : |
29- python -m venv venv
30- source venv/bin/activate
31-
32- - name : Install dependencies
33- run : pip install -r requirements.txt
34-
35- # Optional: Add step to run tests here (PyTest, Django test suites, etc.)
36-
37- - name : Zip artifact for deployment
38- run : zip release.zip ./* -r
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+
5+ name : Build and deploy Python app to Azure Web App - EOAgriTool
6+
7+ on :
8+ push :
9+ branches :
10+ - main
11+ workflow_dispatch :
12+
13+ jobs :
14+ build :
15+ runs-on : ubuntu-latest
16+ permissions :
17+ contents : read # This is required for actions/checkout
18+
19+ steps :
20+ - uses : actions/checkout@v4
21+
22+ - name : Set up Python version
23+ uses : actions/setup-python@v5
24+ with :
25+ python-version : ' 3.9'
26+
27+ - name : Create and start virtual environment
28+ run : |
29+ python -m venv venv
30+ source venv/bin/activate
31+
32+ - name : Install dependencies
33+ run : pip install -r requirements.txt
34+
35+ # Optional: Add step to run tests here (PyTest, Django test suites, etc.)
36+
37+ - name : Zip artifact for deployment
38+ run : zip release.zip ./* -r
39+
3940 - name : GitHub Pages action
40- 41- - name : Upload artifact for deployment jobs
42- uses : actions/upload-artifact@v4
43- with :
44- name : python-app
45- path : |
46- release.zip
47- !venv/
48-
49- deploy :
50- runs-on : ubuntu-latest
51- needs : build
41+ 42+
43+ - name : Upload artifact for deployment jobs
44+ uses : actions/upload-artifact@v4
45+ with :
46+ name : python-app
47+ path : |
48+ release.zip
49+ !venv/
50+
51+ deploy :
52+ runs-on : ubuntu-latest
53+ needs : build
5254 environment :
5355 name : ' Production'
54- url : ${{ steps.deploy-to-webapp.outputs.webapp-url }}
56+ url : ${{ steps.deploy-to-webapp.outputs.webapp-url }}
5557 permissions :
56- id-token : write # This is required for requesting the JWT
57- contents : read # This is required for actions/checkout
58-
59- steps :
60- - name : Download artifact from build job
61- uses : actions/download-artifact@v4
62- with :
63- name : python-app
64-
65- - name : Unzip artifact for deployment
66- run : unzip release.zip
67-
58+ id-token : write # This is required for requesting the JWT
59+ contents : read # This is required for actions/checkout
60+
61+ steps :
62+ - name : Download artifact from build job
63+ uses : actions/download-artifact@v4
64+ with :
65+ name : python-app
66+
67+ - name : Unzip artifact for deployment
68+ run : unzip release.zip
69+
6870 - name : eonx-com/actions-opsgenie
69- 70- with : API_KEY: ${{ secrets.OPSGENIE_GITHUB_TOKEN }}
71+ 72+ with :
73+ API_KEY : ${{ secrets.OPSGENIE_GITHUB_TOKEN }}
7174 PRIORITY : ' P1'
7275 ALIAS : ' deploy-production-failed'
73- MESSAGE : ' Deployment to production failed. please review Github Actions logs'
76+ MESSAGE : ' Deployment to production failed. Please review GitHub Actions logs.'
77+
7478 - name : Login to Azure
7579 uses : azure/login@v2
7680 with :
7781 client-id : ${{ secrets.AZUREAPPSERVICE_CLIENTID_4B2AA51C8F3E408F929B19AAB9401302 }}
7882 tenant-id : ${{ secrets.AZUREAPPSERVICE_TENANTID_39535BE70D534ABDB745C9214BE55081 }}
7983 subscription-id : ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_BB2D4206F5AC44CDA3289568B63A38F7 }}
80-
81- - name : ' Deploy to Azure Web App'
82- uses : azure/webapps-deploy@v3
83- id : deploy-to-webapp
84- with :
85- app-name : ' EOAgriTool'
86- slot-name : ' Production'
87-
84+
85+ - name : Deploy to Azure Web App
86+ uses : azure/webapps-deploy@v3
87+ id : deploy-to-webapp
88+ with :
89+ app-name : ' EOAgriTool'
90+ slot-name : ' Production'
0 commit comments