Skip to content

Commit fa782bb

Browse files
committed
github action
1 parent e24d359 commit fa782bb

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Deploy Azure Function App
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Trigger deployment on push to the main branch
7+
workflow_dispatch: # Allow manual trigger from the Actions tab
8+
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v2
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.9' # Specify the Python version
21+
22+
- name: Create virtual environment
23+
run: python3 -m venv .azure_function_fastapi_venv
24+
25+
- name: Activate virtual environment and install dependencies
26+
run: |
27+
source .azure_function_fastapi_venv/bin/activate
28+
python -m pip install --upgrade pip
29+
pip install -r requirements.txt
30+
31+
- name: Azure Login
32+
uses: azure/login@v1
33+
with:
34+
creds: ${{ secrets.AZURE_CREDENTIALS }}
35+
36+
- name: Deploy to Azure Function App
37+
uses: azure/functions-action@v1
38+
with:
39+
app-name: ${{ secrets.PROJECT_NAME }} # Replace with your Function App name
40+
package: '.' # Specify the directory to deploy, usually the current directory

fastapi_project/api/root_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
@router.get("/")
99
async def root_index(request: Request):
1010
data = {
11-
'message': 'azure function project is running'
11+
'message': 'azure function project is running.'
1212
}
1313
return JSONResponse(content=data, status_code=status.HTTP_200_OK)
1414

0 commit comments

Comments
 (0)