6
6
- main # Trigger deployment on push to the main branch
7
7
workflow_dispatch : # Allow manual trigger from the Actions tab
8
8
9
+ env :
10
+ # set this to your function app name on Azure
11
+ AZURE_FUNCTIONAPP_PACKAGE_PATH : ' .' # set this to the path to your function app project, defaults to the repository root
12
+ PYTHON_VERSION : ' 3.10'
13
+
9
14
jobs :
10
15
build-and-deploy :
11
16
runs-on : ubuntu-latest
@@ -14,20 +19,18 @@ jobs:
14
19
- name : Checkout repository
15
20
uses : actions/checkout@v2
16
21
17
- - name : Set up Python
22
+ - name : Setup Python ${{ env.PYTHON_VERSION }} Environment
18
23
uses : actions/setup-python@v4
19
24
with :
20
- python-version : ' 3.10' # Specify the Python version
21
-
22
- - name : Create virtual environment
23
- run : python3 -m venv .azure_function_fastapi_venv
25
+ python-version : ${{ env.PYTHON_VERSION }}
24
26
25
- - name : Activate virtual environment and install dependencies
27
+ - name : ' Resolve Project Dependencies Using Pip'
28
+ shell : bash
26
29
run : |
27
-
30
+ pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
28
31
python -m pip install --upgrade pip
29
32
pip install -r requirements.txt --target=".python_packages/lib/site-packages"
30
-
33
+ popd
31
34
32
35
- name : Azure Login
33
36
uses : azure/login@v1
38
41
uses : azure/functions-action@v1
39
42
with :
40
43
app-name : ${{ secrets.PROJECT_NAME }} # Replace with your Function App name
41
- package : ' .' # Specify the directory to deploy, usually the current directory
44
+ package : ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
45
+ publish-profile : ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
42
46
scm-do-build-during-deployment : true
43
47
enable-oryx-build : true
0 commit comments