|
| 1 | +name: Function App Deploy Template |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + environment: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + default: "dev" |
| 10 | + description: "Specifies the environment of the deployment." |
| 11 | + python_version: |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + default: "3.10" |
| 15 | + description: "Specifies the python version." |
| 16 | + function_directory: |
| 17 | + required: true |
| 18 | + type: string |
| 19 | + description: "Specifies the directory of the Azure Function." |
| 20 | + function_name: |
| 21 | + required: true |
| 22 | + type: string |
| 23 | + description: "Specifies the name of the Azure Function." |
| 24 | + secrets: |
| 25 | + FUNCTION_PUBLISH_PROFILE: |
| 26 | + required: true |
| 27 | + description: "Specifies the publish profile of the function." |
| 28 | + |
| 29 | +jobs: |
| 30 | + deployment: |
| 31 | + name: Function App Deploy |
| 32 | + runs-on: self-hosted |
| 33 | + continue-on-error: false |
| 34 | + environment: ${{ inputs.environment }} |
| 35 | + |
| 36 | + steps: |
| 37 | + # Setup Python 3.10 |
| 38 | + - name: Setup Python 3.10 |
| 39 | + id: python_setup |
| 40 | + uses: actions/setup-python@v4 |
| 41 | + with: |
| 42 | + python-version: ${{ inputs.python_version }} |
| 43 | + |
| 44 | + # Check Out Repository |
| 45 | + - name: Check Out Repository |
| 46 | + id: checkout_repository |
| 47 | + uses: actions/checkout@v3 |
| 48 | + |
| 49 | + # Install Function Dependencies |
| 50 | + - name: Resolve Function Dependencies |
| 51 | + id: function_dependencies |
| 52 | + shell: bash |
| 53 | + run: | |
| 54 | + pushd '${{ inputs.function_directory }}' |
| 55 | + python -m pip install --upgrade pip |
| 56 | + pip install -r requirements.txt --target=".python_packages/lib/site-packages" |
| 57 | + popd |
| 58 | +
|
| 59 | + # Deploy Function |
| 60 | + - name: Deploy Function |
| 61 | + id: function_deploy |
| 62 | + uses: Azure/functions-action@v1 |
| 63 | + with: |
| 64 | + app-name: ${{ inputs.function_name }} |
| 65 | + package: ${{ inputs.function_directory }} |
| 66 | + publish-profile: ${{ secrets.FUNCTION_PUBLISH_PROFILE }} |
| 67 | + scm-do-build-during-deployment: true |
| 68 | + enable-oryx-build: true |
0 commit comments