File tree Expand file tree Collapse file tree 1 file changed +69
-0
lines changed
Expand file tree Collapse file tree 1 file changed +69
-0
lines changed Original file line number Diff line number Diff line change 1+ name : CI/CD
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ workflow_dispatch :
8+
9+ env :
10+ AZURE_FUNCTIONAPP_PACKAGE_PATH : ' .'
11+ PYTHON_VERSION : ' 3.10'
12+
13+ jobs :
14+ build :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - name : Checkout repository
18+ uses : actions/checkout@v4
19+
20+ - name : Setup Python version
21+ uses : actions/setup-python@v5
22+ with :
23+ python-version : ${{ env.PYTHON_VERSION }}
24+
25+ - name : Create and start virtual environment
26+ run : |
27+ python -m venv venv
28+ source venv/bin/activate
29+
30+ - name : Install dependencies
31+ run : pip install -r requirements.txt
32+
33+ - name : Zip artifact for deployment
34+ run : zip -r release.zip host.json requirements.txt function_app.py
35+
36+ - name : Upload artifact for deployment job
37+ uses : actions/upload-artifact@v3
38+ with :
39+ name : python-app
40+ path : |
41+ release.zip
42+ !venv/
43+
44+ deploy :
45+ runs-on : ubuntu-latest
46+ needs : build
47+ environment :
48+ name : ' Production'
49+ url : ${{ steps.deploy-to-function.outputs.webapp-url }}
50+
51+ steps :
52+ - name : Download artifact from build job
53+ uses : actions/download-artifact@v3
54+ with :
55+ name : python-app
56+
57+ - name : Unzip artifact for deployment
58+ run : unzip release.zip
59+
60+ - name : ' Deploy to Azure Functions'
61+ uses : Azure/functions-action@v1
62+ id : deploy-to-function
63+ with :
64+ app-name : ' hvalfangstlinuxfunctionapp'
65+ slot-name : ' Production'
66+ package : ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
67+ scm-do-build-during-deployment : true
68+ enable-oryx-build : true
69+ publish-profile : ${{ secrets.PUBLISH_PROFILE }}
You can’t perform that action at this time.
0 commit comments