|
| 1 | +--- |
| 2 | +# Copyright (c) 2025 The Regents of the University of California |
| 3 | +# SPDX-License-Identifier: BSD-3-Clause |
| 4 | + |
1 | 5 | name: Deploy Python project to Azure Function App |
2 | 6 |
|
| 7 | +on: |
| 8 | + workflow_dispatch: # allows manual triggering of the workflow |
| 9 | + |
3 | 10 | # on: |
4 | 11 | # push: |
5 | 12 | # branches: |
6 | 13 | # - main # only run on pushes to main |
7 | 14 |
|
8 | 15 | env: |
9 | | - AZURE_FUNCTIONAPP_NAME: 'gem5-resources-api' |
10 | | - AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # function API code lives in the repo root |
11 | | - PYTHON_VERSION: '3.12' |
| 16 | + AZURE_FUNCTIONAPP_NAME: gem5-resources-api |
| 17 | + |
| 18 | + # function API code lives in the repo root |
| 19 | + AZURE_FUNCTIONAPP_PACKAGE_PATH: . |
| 20 | + PYTHON_VERSION: '3.12' |
12 | 21 |
|
13 | 22 | jobs: |
14 | | - build-and-deploy: |
15 | | - runs-on: ubuntu-latest |
16 | | - steps: |
17 | | - - name: Checkout code |
18 | | - uses: actions/checkout@v3 |
19 | | - |
20 | | - - name: Set up Python ${{ env.PYTHON_VERSION }} |
21 | | - uses: actions/setup-python@v4 |
22 | | - with: |
23 | | - python-version: ${{ env.PYTHON_VERSION }} |
24 | | - |
25 | | - - name: Install dependencies into .python_packages |
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 |
31 | | -
|
32 | | - - name: Deploy to Azure Functions |
33 | | - uses: Azure/functions-action@v1 |
34 | | - with: |
35 | | - app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} |
36 | | - package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} |
37 | | - publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} |
38 | | - scm-do-build-during-deployment: true |
39 | | - enable-oryx-build: true |
| 23 | + build-and-deploy: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - name: Checkout code |
| 27 | + uses: actions/checkout@v3 |
| 28 | + |
| 29 | + - name: Set up Python ${{ env.PYTHON_VERSION }} |
| 30 | + uses: actions/setup-python@v4 |
| 31 | + with: |
| 32 | + python-version: ${{ env.PYTHON_VERSION }} |
| 33 | + |
| 34 | + - name: Install dependencies into .python_packages |
| 35 | + run: | |
| 36 | + pushd ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} |
| 37 | + python -m pip install --upgrade pip |
| 38 | + pip install -r requirements.txt \ |
| 39 | + --target=".python_packages/lib/site-packages" |
| 40 | + popd |
| 41 | +
|
| 42 | + - name: Deploy to Azure Functions |
| 43 | + uses: Azure/functions-action@v1 |
| 44 | + with: |
| 45 | + app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} |
| 46 | + package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} |
| 47 | + publish-profile: | |
| 48 | + ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} |
| 49 | + scm-do-build-during-deployment: true |
| 50 | + enable-oryx-build: true |
0 commit comments