-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (41 loc) · 1.94 KB
/
deploy API.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
46
47
48
49
# Tim Walter, 2024-03-31
# Deploy Python API for Chatbot Demo to Azure Function App
# Modified Github Action-Script taken from Microsoft Template Repository
name: Deploy Python API to Azure Function App
on:
[push]
env:
AZURE_FUNCTIONAPP_NAME: ${{ vars.AZURE_FUNCTIONAPP_NAME }} # TimW: Set Repo Variable to the Name if the Azure Function App we're deploaying to
AZURE_FUNCTIONAPP_PACKAGE_PATH: ${{ vars.AZURE_FUNCTIONAPP_PACKAGE_PATH }} # TimW: Function App is stored in the Repo where Variable points to
PYTHON_VERSION: '3.10' # Python version, in our case 3.10
jobs:
build-and-deploy:
runs-on: ubuntu-latest
# environment: dev # TimW: We aren't using any environment here but rather read varaibles and secrets straight from the repository
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3
- name: 'Azure CLI login'
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }} # TimW: Contains Azure Credential Object with Subscription ID, Tenant ID, Client ID, Client Secret taken from Repo Secrets
- 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 }} # TimW: See comments above
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} # TimW: Publishing Profile is a secret in the repository
scm-do-build-during-deployment: true
enable-oryx-build: true