From dd5bd66920f14dd667bb557cfb50bec558732f9d Mon Sep 17 00:00:00 2001 From: Mostafa Kamal Date: Sun, 19 May 2024 03:42:35 +0600 Subject: [PATCH] action check --- .github/workflows/azure-functions-deploy.yml | 22 ++++++++++++-------- fastapi_project/api/root_index.py | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/azure-functions-deploy.yml b/.github/workflows/azure-functions-deploy.yml index bece9f3..476a1a9 100644 --- a/.github/workflows/azure-functions-deploy.yml +++ b/.github/workflows/azure-functions-deploy.yml @@ -6,6 +6,11 @@ on: - main # Trigger deployment on push to the main branch workflow_dispatch: # Allow manual trigger from the Actions tab +env: + # set this to your function app name on Azure + AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your function app project, defaults to the repository root + PYTHON_VERSION: '3.10' + jobs: build-and-deploy: runs-on: ubuntu-latest @@ -14,20 +19,18 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 - - name: Set up Python + - name: Setup Python ${{ env.PYTHON_VERSION }} Environment uses: actions/setup-python@v4 with: - python-version: '3.10' # Specify the Python version - - - name: Create virtual environment - run: python3 -m venv .azure_function_fastapi_venv + python-version: ${{ env.PYTHON_VERSION }} - - name: Activate virtual environment and install dependencies + - name: 'Resolve Project Dependencies Using Pip' + shell: bash run: | - + pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}' python -m pip install --upgrade pip pip install -r requirements.txt --target=".python_packages/lib/site-packages" - + popd - name: Azure Login uses: azure/login@v1 @@ -38,6 +41,7 @@ jobs: uses: azure/functions-action@v1 with: app-name: ${{ secrets.PROJECT_NAME }} # Replace with your Function App name - package: '.' # Specify the directory to deploy, usually the current directory + package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} + publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} scm-do-build-during-deployment: true enable-oryx-build: true diff --git a/fastapi_project/api/root_index.py b/fastapi_project/api/root_index.py index f64b425..05f0e64 100644 --- a/fastapi_project/api/root_index.py +++ b/fastapi_project/api/root_index.py @@ -8,7 +8,7 @@ @router.get("/") async def root_index(request: Request): data = { - 'message': 'azure function project is running.' + 'message': 'azure function project is running.now' } return JSONResponse(content=data, status_code=status.HTTP_200_OK) \ No newline at end of file