Skip to content

Commit 77fc1cb

Browse files
committed
ci/cd
1 parent db060f7 commit 77fc1cb

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

.github/workflows/deploy.yml

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,44 @@
1-
name: Deploy Python project to Azure Function App
1+
name: Deploy fastapi project to Azure Function App
22

33
on:
4-
[push]
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
58

69
env:
7-
AZURE_FUNCTIONAPP_NAME: 'fastapi-demo' # set this to your function app name on Azure
8-
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your function app project, defaults to the repository root
9-
PYTHON_VERSION: '3.11' # set this to the python version to use (e.g. '3.6', '3.7', '3.8')
10+
AZURE_FUNCTIONAPP_NAME: 'fastapi-demo' # Set this to your function app name on Azure
11+
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # Set this to the path to your function app project, defaults to the repository root
12+
PYTHON_VERSION: '3.11' # Set this to the python version to use (e.g. '3.6', '3.7', '3.8', '3.11')
1013

1114
jobs:
1215
build-and-deploy:
1316
runs-on: ubuntu-latest
1417
environment: dev
18+
1519
steps:
16-
- name: 'Checkout GitHub Action'
17-
uses: actions/checkout@v3
20+
- name: 'Checkout GitHub Action'
21+
uses: actions/checkout@v3
1822

19-
- name: Setup Python ${{ env.PYTHON_VERSION }} Environment
20-
uses: actions/setup-python@v4
21-
with:
22-
python-version: ${{ env.PYTHON_VERSION }}
23+
- name: Setup Python ${{ env.PYTHON_VERSION }} Environment
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: ${{ env.PYTHON_VERSION }}
2327

24-
- name: 'Resolve Project Dependencies Using Pip'
25-
shell: bash
26-
run: |
27-
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
28-
python -m pip install --upgrade pip
29-
pip install -r requirements.txt --target=".python_packages/lib/site-packages"
30-
popd
28+
- name: 'Resolve Project Dependencies Using Pip'
29+
shell: bash
30+
run: |
31+
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
32+
python -m pip install --upgrade pip
33+
pip install -r requirements.txt --target=".python_packages/lib/site-packages"
34+
popd
3135
32-
- name: 'Run Azure Functions Action'
33-
uses: Azure/functions-action@v1
34-
id: fa
35-
with:
36-
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
37-
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
38-
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
39-
scm-do-build-during-deployment: true
40-
enable-oryx-build: true
36+
- name: 'Run Azure Functions Action'
37+
uses: Azure/functions-action@v1
38+
id: fa
39+
with:
40+
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
41+
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
42+
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
43+
scm-do-build-during-deployment: true
44+
enable-oryx-build: true

0 commit comments

Comments
 (0)