-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (39 loc) · 1.69 KB
/
cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Deploy Python project to Azure Function App
on:
push:
branches:
- "main"
- "dev"
env:
AZURE_FUNCTIONAPP_NAME_PROD: "prorg"
AZURE_FUNCTIONAPP_NAME_DEV: "prorg-dev"
AZURE_FUNCTIONAPP_PACKAGE_PATH: "." # set this to the path to your function app project, defaults to the repository root
PYTHON_VERSION: "3.9" # 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: production
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: ${{ github.ref == 'refs/heads/main' && env.AZURE_FUNCTIONAPP_NAME_PROD || env.AZURE_FUNCTIONAPP_NAME_DEV }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ github.ref == 'refs/heads/main' && secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE_PROD || secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE_DEV }}
scm-do-build-during-deployment: true
enable-oryx-build: true
# For more samples to get started with GitHub Action workflows to deploy to Azure, refer to https://github.com/Azure/actions-workflow-samples