66 - main # Trigger deployment on push to the main branch
77 workflow_dispatch : # Allow manual trigger from the Actions tab
88
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+
914jobs :
1015 build-and-deploy :
1116 runs-on : ubuntu-latest
@@ -14,20 +19,18 @@ jobs:
1419 - name : Checkout repository
1520 uses : actions/checkout@v2
1621
17- - name : Set up Python
22+ - name : Setup Python ${{ env.PYTHON_VERSION }} Environment
1823 uses : actions/setup-python@v4
1924 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 }}
2426
25- - name : Activate virtual environment and install dependencies
27+ - name : ' Resolve Project Dependencies Using Pip'
28+ shell : bash
2629 run : |
27-
30+ pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
2831 python -m pip install --upgrade pip
2932 pip install -r requirements.txt --target=".python_packages/lib/site-packages"
30-
33+ popd
3134
3235 - name : Azure Login
3336 uses : azure/login@v1
3841 uses : azure/functions-action@v1
3942 with :
4043 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 }}
4246 scm-do-build-during-deployment : true
4347 enable-oryx-build : true
0 commit comments