From 66f2bb07b09fd5439de2887c5bcca36dc7a75d34 Mon Sep 17 00:00:00 2001 From: antidoid Date: Wed, 31 Jan 2024 15:54:08 +0530 Subject: [PATCH] FEAT: CI/CD for function app --- .../workflows/deploy-function-to-Azure.yml | 39 +++++++++++++++++++ .nojekyll | 0 2 files changed, 39 insertions(+) create mode 100644 .github/workflows/deploy-function-to-Azure.yml delete mode 100644 .nojekyll diff --git a/.github/workflows/deploy-function-to-Azure.yml b/.github/workflows/deploy-function-to-Azure.yml new file mode 100644 index 0000000..a37dd0c --- /dev/null +++ b/.github/workflows/deploy-function-to-Azure.yml @@ -0,0 +1,39 @@ +name: Deploy Python project to Azure Function App + +on: [push] + +env: + AZURE_FUNCTIONAPP_NAME: "az-qr-code-func" # set this to your function app name on Azure + AZURE_FUNCTIONAPP_PACKAGE_PATH: ".qrCodeGenerator" # set this to the path to your function app project, defaults to the repository root + PYTHON_VERSION: "3.11" # set this to the python version to use (e.g. '3.6', '3.7', '3.8') + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + environment: dev + steps: + - name: "Checkout GitHub Action" + uses: actions/checkout@v3 + + - name: Setup Python ${{ env.PYTHON_VERSION }} Environment + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - 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: "Run Azure Functions Action" + uses: Azure/functions-action@v1 + id: fa + with: + app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} + 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/.nojekyll b/.nojekyll deleted file mode 100644 index e69de29..0000000