1
- name : Deploy Python project to Azure Function App
1
+ name : Deploy fastapi project to Azure Function App
2
2
3
3
on :
4
- [push]
4
+ push :
5
+ branches :
6
+ - main
7
+ workflow_dispatch :
5
8
6
9
env :
7
- AZURE_FUNCTIONAPP_NAME : ' fastapi-demo' # set this to your function app name on Azure
8
- AZURE_FUNCTIONAPP_PACKAGE_PATH : ' .' # set this to the path to your function app project, defaults to the repository root
9
- PYTHON_VERSION : ' 3.11' # set this to the python version to use (e.g. '3.6', '3.7', '3.8')
10
+ AZURE_FUNCTIONAPP_NAME : ' fastapi-demo' # 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.11' # Set this to the python version to use (e.g. '3.6', '3.7', '3.8', '3.11 ')
10
13
11
14
jobs :
12
15
build-and-deploy :
13
16
runs-on : ubuntu-latest
14
17
environment : dev
18
+
15
19
steps :
16
- - name : ' Checkout GitHub Action'
17
- uses : actions/checkout@v3
20
+ - name : ' Checkout GitHub Action'
21
+ uses : actions/checkout@v3
18
22
19
- - name : Setup Python ${{ env.PYTHON_VERSION }} Environment
20
- uses : actions/setup-python@v4
21
- with :
22
- python-version : ${{ env.PYTHON_VERSION }}
23
+ - name : Setup Python ${{ env.PYTHON_VERSION }} Environment
24
+ uses : actions/setup-python@v4
25
+ with :
26
+ python-version : ${{ env.PYTHON_VERSION }}
23
27
24
- - name : ' Resolve Project Dependencies Using Pip'
25
- shell : bash
26
- run : |
27
- pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
28
- python -m pip install --upgrade pip
29
- pip install -r requirements.txt --target=".python_packages/lib/site-packages"
30
- popd
28
+ - name : ' Resolve Project Dependencies Using Pip'
29
+ shell : bash
30
+ run : |
31
+ pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
32
+ python -m pip install --upgrade pip
33
+ pip install -r requirements.txt --target=".python_packages/lib/site-packages"
34
+ popd
31
35
32
- - name : ' Run Azure Functions Action'
33
- uses : Azure/functions-action@v1
34
- id : fa
35
- with :
36
- app-name : ${{ env.AZURE_FUNCTIONAPP_NAME }}
37
- package : ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
38
- publish-profile : ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
39
- scm-do-build-during-deployment : true
40
- enable-oryx-build : true
36
+ - name : ' Run Azure Functions Action'
37
+ uses : Azure/functions-action@v1
38
+ id : fa
39
+ with :
40
+ app-name : ${{ env.AZURE_FUNCTIONAPP_NAME }}
41
+ package : ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
42
+ publish-profile : ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
43
+ scm-do-build-during-deployment : true
44
+ enable-oryx-build : true
0 commit comments