|
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 - hamalertspotbot |
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@v1 |
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@v3 |
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 |
| - environment: |
54 |
| - name: 'Production' |
55 |
| - url: ${{ steps.deploy-to-function.outputs.webapp-url }} |
56 |
| - |
57 |
| - steps: |
58 |
| - - name: Download artifact from build job |
59 |
| - uses: actions/download-artifact@v3 |
60 |
| - with: |
61 |
| - name: python-app |
62 |
| - |
63 |
| - - name: Unzip artifact for deployment |
64 |
| - run: unzip release.zip |
65 |
| - |
66 |
| - - name: 'Deploy to Azure Functions' |
67 |
| - uses: Azure/functions-action@v1 |
68 |
| - id: deploy-to-function |
69 |
| - with: |
70 |
| - app-name: 'hamalertspotbot' |
71 |
| - slot-name: 'Production' |
72 |
| - package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} |
73 |
| - publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_2A375008FC1743E4AE2D6A345036BDC4 }} |
74 |
| - scm-do-build-during-deployment: true |
75 |
| - enable-oryx-build: true |
| 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 - hamalertspotbot |
| 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@v1 |
| 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@v3 |
| 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 | + environment: |
| 54 | + name: 'Production' |
| 55 | + url: ${{ steps.deploy-to-function.outputs.webapp-url }} |
| 56 | + |
| 57 | + steps: |
| 58 | + - name: Download artifact from build job |
| 59 | + uses: actions/download-artifact@v3 |
| 60 | + with: |
| 61 | + name: python-app |
| 62 | + |
| 63 | + - name: Unzip artifact for deployment |
| 64 | + run: unzip release.zip |
| 65 | + |
| 66 | + - name: 'Deploy to Azure Functions' |
| 67 | + uses: Azure/functions-action@v1 |
| 68 | + id: deploy-to-function |
| 69 | + with: |
| 70 | + app-name: 'hamalertspotbot' |
| 71 | + slot-name: 'Production' |
| 72 | + package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} |
| 73 | + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_2A375008FC1743E4AE2D6A345036BDC4 }} |
| 74 | + scm-do-build-during-deployment: true |
| 75 | + enable-oryx-build: true |
0 commit comments