Skip to content

Build and deploy Python project to Azure Function App - ccom-funcs-dev #312

Build and deploy Python project to Azure Function App - ccom-funcs-dev

Build and deploy Python project to Azure Function App - ccom-funcs-dev #312

# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy Python project to Azure Function App - ccom-funcs-dev
on:
push:
branches:
- devel
workflow_dispatch:
env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: './app/workers'
PYTHON_VERSION: '3.8' # set this to the python version to use (supports 3.6, 3.7, 3.8)
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v2
- name: Setup Python ${{ env.PYTHON_VERSION }} Environment
uses: actions/setup-python@v1
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: 'Install Poetry'
uses: snok/install-poetry@v1
- name: 'Resolve Project Dependencies Using Poetry'
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
poetry config virtualenvs.create false
poetry export --format requirements.txt --output requirements.txt
popd
shell: bash
- name: 'Install 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/[email protected]
id: fa
with:
app-name: 'ccom-funcs-dev'
slot-name: 'production'
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZURE_FUNCAPP_PUBLISH_PROFILE }}