Skip to content

Commit 4ddb244

Browse files
committed
Add or update the Azure App Service build and deployment workflow config
1 parent 1645f59 commit 4ddb244

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

.github/workflows/main_trutlepods.yml

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
2+
# More GitHub Actions for Azure: https://github.com/Azure/actions
3+
# More info on Python, GitHub Actions, and Azure Functions: https://aka.ms/python-webapps-actions
4+
5+
name: Build and deploy Python project to Azure Function App - trutlepods
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
workflow_dispatch:
12+
13+
env:
14+
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
15+
PYTHON_VERSION: '3.11' # set this to the python version to use (supports 3.6, 3.7, 3.8)
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Python version
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: ${{ env.PYTHON_VERSION }}
28+
29+
- name: Create and start virtual environment
30+
run: |
31+
python -m venv venv
32+
source venv/bin/activate
33+
34+
- name: Install dependencies
35+
run: pip install -r requirements.txt
36+
37+
# Optional: Add step to run tests here
38+
39+
- name: Zip artifact for deployment
40+
run: zip release.zip ./* -r
41+
42+
- name: Upload artifact for deployment job
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: python-app
46+
path: |
47+
release.zip
48+
!venv/
49+
50+
deploy:
51+
runs-on: ubuntu-latest
52+
needs: build
53+
54+
permissions:
55+
id-token: write #This is required for requesting the JWT
56+
57+
steps:
58+
- name: Download artifact from build job
59+
uses: actions/download-artifact@v4
60+
with:
61+
name: python-app
62+
63+
- name: Unzip artifact for deployment
64+
run: unzip release.zip
65+
66+
- name: Login to Azure
67+
uses: azure/login@v2
68+
with:
69+
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_B144830EE98B4CFC8D4D60B704192298 }}
70+
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_415C405FBBFA4BF897AE3E5E461D9B72 }}
71+
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_4041C8578ED2440E882D7A4AA2C2A41F }}
72+
73+
- name: 'Deploy to Azure Functions'
74+
uses: Azure/functions-action@v1
75+
id: deploy-to-function
76+
with:
77+
app-name: 'trutlepods'
78+
slot-name: 'Production'
79+
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
80+

0 commit comments

Comments
 (0)