I have the same code in function_app.py file alike you.
I am trying to deploy the codes to function app using GitHub action with the help of below given script.
```yaml
name: Build and deploy Python project to Azure Function App - afreeen-fa
on:
push:
branches:
- main
workflow_dispatch:
env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.'
PYTHON_VERSION: '3.11'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python version
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: pip install -r requirements.txt
- name: Zip artifact for deployment
run: zip release.zip ./* -r
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: python-app
path: |
release.zip
!venv/
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: python-app
- name: Unzip artifact for deployment
run: unzip release.zip
- name: 'Deploy to Azure Functions'
uses: Azure/functions-action@v1
id: deploy-to-function
with:
app-name: 'afreeen-fa'
slot-name: 'Production'
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_BEA2A185EB094***8218 }}
```
Post successful deployment, I can see the functions in function app's Overview blade as shown below.

***I created one sample Azure Storage queue trigger with Python v2 Programming model and deployed it via Github actions like below:-***
**My function_app.py code:-**
```py
import azure.functions as func
import logging
app = func.FunctionApp()
@app.queue_trigger(arg_name="azqueue", queue_name="myqueue",
connection="valleystrg129_STORAGE")
def queue_trigger(azqueue: func.QueueMessage):
logging.info('Python Queue trigger processed a message: %s',
azqueue.get_body().decode('utf-8'))
```
**host.json:-**
```json
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
},
"concurrency": {
"dynamicConcurrencyEnabled": true,
"snapshotPersistenceEnabled": true
}
}
```
**local.settings.json:-**
```json
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "python",
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=valleystrg129;AccountKey=xxxxxyVIUxxxd0ZrE7BVInRkzDF+AStPI60+Q==;EndpointSuffix=core.windows.net",
"AzureWebJobsFeatureFlags": "EnableWorkerIndexing",
"valleystrg129_STORAGE": "DefaultEndpointsProtocol=https;AccountName=valleystrg129;AccountKey=xxxxyVIUtd15vOnm8wt4xxxxkzDF+AStPI60+Q==;EndpointSuffix=core.windows.net"
}
}
```

My Function queue trigger got deployed to Function app successfully like below:-
**My github action workflow:-**
```yaml
name: Build and deploy Python project to Azure Function App - valleyfunc496
on:
push:
branches:
- master
workflow_dispatch:
env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.'
PYTHON_VERSION: '3.10'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Python version
uses: actions/setup-python@v1
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: pip install -r requirements.txt
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: python-app
path: |
.
!venv/
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-function.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: python-app
path: .
- name: 'Deploy to Azure Functions'
uses: Azure/functions-action@v1
id: deploy-to-function
with:
app-name: 'valleyfunc496'
slot-name: 'Production'
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_4F433CE262C6430E9690DCA16871A27B }}
scm-do-build-during-deployment: true
enable-oryx-build: true
```
**Output:-**
