1- # Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
2- # More GitHub Actions for Azure: https://github.com/Azure/actions
3- # More info on Python, GitHub Actions, and Azure Functions: https://aka.ms/python-webapps-actions
4-
5- name : Build and deploy Python project to Azure Function App - watchoutMicroservice
6-
7- on :
8- push :
9- branches :
10- - master
11- workflow_dispatch :
12-
13- env :
14- AZURE_FUNCTIONAPP_PACKAGE_PATH : ' . ' # set this to the path to your web app project, defaults to the repository root
15- PYTHON_VERSION : ' 3.13' # set this to the python version to use (supports 3.6, 3.7, 3.8)
16-
17- jobs :
18- build :
19- runs-on : ubuntu-latest
20- permissions :
21- contents : read # This is required for actions/checkout
22-
23- steps :
24- - name : Checkout repository
25- uses : actions/checkout@v4
26-
27- - name : Setup Python version
28- uses : actions/setup-python@v5
29- with :
30- python-version : ${{ env.PYTHON_VERSION }}
31-
32- - name : Create and start virtual environment
33- run : |
34- python -m venv venv
35- source venv/bin/activate
36-
37- - name : Install dependencies
38- run : pip install -r requirements.txt
39-
40- # Optional: Add step to run tests here
41-
42- - name : Zip artifact for deployment
43- run : zip release.zip ./* -r
44-
45- - name : Upload artifact for deployment job
46- uses : actions/upload-artifact@v4
47- with :
48- name : python-app
49- path : |
50- release.zip
51- !venv/
52-
53- deploy :
54- runs-on : ubuntu-latest
55- needs : build
56-
57- steps :
58- - name : Download artifact from build job
59- uses : actions/download-artifact@v4
60- with :
61- name : python-app
62-
63- - name : Unzip artifact for deployment
64- run : |
65- unzip release.zip
66- rm release.zip
67-
68- - name : ' Deploy to Azure Functions'
69- uses : Azure/functions-action@v1
70- id : deploy-to-function
71- with :
72- app-name : ' watchoutMicroservice'
73- slot-name : ' Production'
74- package : ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
1+ # Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
2+ # More GitHub Actions for Azure: https://github.com/Azure/actions
3+ # More info on Python, GitHub Actions, and Azure Functions: https://aka.ms/python-webapps-actions
4+
5+ name : Build and deploy Python project to Azure Function App - watchoutMicroservice
6+
7+ on :
8+ push :
9+ branches :
10+ - master
11+ workflow_dispatch :
12+
13+ env :
14+ AZURE_FUNCTIONAPP_PACKAGE_PATH : ' Microservice ' # set this to the path to your web app project, defaults to the repository root
15+ PYTHON_VERSION : ' 3.13' # set this to the python version to use (supports 3.6, 3.7, 3.8)
16+
17+ jobs :
18+ build :
19+ runs-on : ubuntu-latest
20+ permissions :
21+ contents : read # This is required for actions/checkout
22+
23+ steps :
24+ - name : Checkout repository
25+ uses : actions/checkout@v4
26+
27+ - name : Setup Python version
28+ uses : actions/setup-python@v5
29+ with :
30+ python-version : ${{ env.PYTHON_VERSION }}
31+
32+ - name : Create and start virtual environment
33+ run : |
34+ python -m venv venv
35+ source venv/bin/activate
36+
37+ - name : Install dependencies
38+ run : pip install -r requirements.txt
39+
40+ # Optional: Add step to run tests here
41+
42+ - name : Zip artifact for deployment
43+ run : zip release.zip ./* -r
44+
45+ - name : Upload artifact for deployment job
46+ uses : actions/upload-artifact@v4
47+ with :
48+ name : python-app
49+ path : |
50+ release.zip
51+ !venv/
52+
53+ deploy :
54+ runs-on : ubuntu-latest
55+ needs : build
56+
57+ steps :
58+ - name : Download artifact from build job
59+ uses : actions/download-artifact@v4
60+ with :
61+ name : python-app
62+
63+ - name : Unzip artifact for deployment
64+ run : |
65+ unzip release.zip
66+ rm release.zip
67+
68+ - name : ' Deploy to Azure Functions'
69+ uses : Azure/functions-action@v1
70+ id : deploy-to-function
71+ with :
72+ app-name : ' watchoutMicroservice'
73+ slot-name : ' Production'
74+ package : ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
7575 publish-profile : ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_CEC693097F424AC3AB3F824CD8E91B13 }}
0 commit comments