Skip to content

Commit 0dab488

Browse files
committed
Add or update the Azure App Service build and deployment workflow config
1 parent c4b5ce6 commit 0dab488

1 file changed

Lines changed: 61 additions & 9 deletions

File tree

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,75 @@
1-
name: Deploy Azure Function (Python v2)
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 - func-plc-dev-001
26

37
on:
48
push:
59
branches:
610
- 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)
716

817
jobs:
9-
build-and-deploy:
18+
build:
1019
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read #This is required for actions/checkout
1122

1223
steps:
13-
- name: Checkout code
24+
- name: Checkout repository
1425
uses: actions/checkout@v4
1526

16-
- name: Deploy to Azure Functions using Zip Deploy (remote build)
27+
- name: Setup Python version
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: ${{ env.PYTHON_VERSION }}
31+
32+
- name: Create and start virtual environment
33+
run: |
34+
python -m venv venv
35+
source venv/bin/activate
36+
37+
- name: Install dependencies
38+
run: pip install -r requirements.txt
39+
40+
# Optional: Add step to run tests here
41+
42+
- name: Zip artifact for deployment
43+
run: zip release.zip ./* -r
44+
45+
- name: Upload artifact for deployment job
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: python-app
49+
path: |
50+
release.zip
51+
!venv/
52+
53+
deploy:
54+
runs-on: ubuntu-latest
55+
needs: build
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: |
65+
unzip release.zip
66+
rm release.zip
67+
68+
- name: 'Deploy to Azure Functions'
1769
uses: Azure/functions-action@v1
70+
id: deploy-to-function
1871
with:
19-
app-name: "func-plc-dev-001"
20-
package: "."
21-
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_B1F462AC55CE4BE08A8A1DC7A595646D }}
22-
scm-do-build-during-deployment: true
23-
enable-oryx-build: true
72+
app-name: 'func-plc-dev-001'
73+
slot-name: 'Production'
74+
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
75+
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_C2FE170628884F60B638D1E1DB952E4E }}

0 commit comments

Comments
 (0)