Skip to content

Commit 78cb2ab

Browse files
Create azure-functions-app-python.yml
# Server On # connect 189.127.164.134:30120 @everyone
1 parent 34c4e05 commit 78cb2ab

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This workflow will build a Python app and deploy it to an Azure Functions App on Linux when a commit is pushed to your default branch.
2+
#
3+
# This workflow assumes you have already created the target Azure Functions app.
4+
# For instructions see https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-python?pivots=python-mode-configuration
5+
#
6+
# To configure this workflow:
7+
# 1. Set up the following secrets in your repository:
8+
# - AZURE_FUNCTIONAPP_PUBLISH_PROFILE
9+
# 2. Change env variables for your configuration.
10+
#
11+
# For more information on:
12+
# - GitHub Actions for Azure: https://github.com/Azure/Actions
13+
# - Azure Functions Action: https://github.com/Azure/functions-action
14+
# - Publish Profile: https://github.com/Azure/functions-action#using-publish-profile-as-deployment-credential-recommended
15+
# - Azure Service Principal for RBAC: https://github.com/Azure/functions-action#using-azure-service-principal-for-rbac-as-deployment-credential
16+
#
17+
# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples/tree/master/FunctionApp
18+
19+
name: Deploy Python project to Azure Function App
20+
21+
on:
22+
push:
23+
branches: ["main"]
24+
25+
env:
26+
AZURE_FUNCTIONAPP_NAME: 'your-app-name' # set this to your function app name on Azure
27+
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your function app project, defaults to the repository root
28+
PYTHON_VERSION: '3.9' # set this to the python version to use (e.g. '3.6', '3.7', '3.8')
29+
30+
jobs:
31+
build-and-deploy:
32+
runs-on: ubuntu-latest
33+
environment: dev
34+
steps:
35+
- name: 'Checkout GitHub Action'
36+
uses: actions/checkout@v4
37+
38+
# If you want to use Azure RBAC instead of Publish Profile, then uncomment the task below
39+
# - name: 'Login via Azure CLI'
40+
# uses: azure/login@v1
41+
# with:
42+
# creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} # set up AZURE_RBAC_CREDENTIALS secrets in your repository
43+
44+
- name: Setup Python ${{ env.PYTHON_VERSION }} Environment
45+
uses: actions/setup-python@v4
46+
with:
47+
python-version: ${{ env.PYTHON_VERSION }}
48+
49+
- name: 'Resolve Project Dependencies Using Pip'
50+
shell: bash
51+
run: |
52+
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
53+
python -m pip install --upgrade pip
54+
pip install -r requirements.txt --target=".python_packages/lib/site-packages"
55+
popd
56+
57+
- name: 'Run Azure Functions Action'
58+
uses: Azure/functions-action@v1
59+
id: fa
60+
with:
61+
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
62+
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
63+
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} # Remove publish-profile to use Azure RBAC
64+
scm-do-build-during-deployment: true
65+
enable-oryx-build: true

0 commit comments

Comments
 (0)