Promptaufbau umgestellt #62
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tim Walter, 2024-03-31 | |
# Deploy Python API for Chatbot Demo to Azure Function App | |
# Modified Github Action-Script taken from Microsoft Template Repository | |
name: Deploy Python API to Azure Function App | |
on: | |
[push] | |
env: | |
AZURE_FUNCTIONAPP_NAME: ${{ vars.AZURE_FUNCTIONAPP_NAME }} # TimW: Set Repo Variable to the Name if the Azure Function App we're deploaying to | |
AZURE_FUNCTIONAPP_PACKAGE_PATH: ${{ vars.AZURE_FUNCTIONAPP_PACKAGE_PATH }} # TimW: Function App is stored in the Repo where Variable points to | |
PYTHON_VERSION: '3.10' # Python version, in our case 3.10 | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
# environment: dev # TimW: We aren't using any environment here but rather read varaibles and secrets straight from the repository | |
steps: | |
- name: 'Checkout GitHub Action' | |
uses: actions/checkout@v3 | |
- name: 'Azure CLI login' | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} # TimW: Contains Azure Credential Object with Subscription ID, Tenant ID, Client ID, Client Secret taken from Repo Secrets | |
- name: Setup Python ${{ env.PYTHON_VERSION }} Environment | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: 'Resolve Project Dependencies Using Pip' | |
shell: bash | |
run: | | |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}' | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt --target=".python_packages/lib/site-packages" | |
popd | |
- name: 'Run Azure Functions Action' | |
uses: Azure/functions-action@v1 | |
id: fa | |
with: | |
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} | |
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} # TimW: See comments above | |
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} # TimW: Publishing Profile is a secret in the repository | |
scm-do-build-during-deployment: true | |
enable-oryx-build: true |