azure - 在 GitHub 存储库上同步 python 代码并部署在 Azure 函数上

标签 azure github azure-functions github-actions

我想同步代码(在 azure 函数文件夹中)。我按照文档创建了 github actions cd。但是,在我的功能部分功能的 azure 门户中,我的文件夹没有出现。任何人都知道问题是什么。我的工作流程中没有错误。

当我尝试重新部署/同步我的代码时遇到错误:找不到它...

My Worflow File

最佳答案

只需发布我如何从 GitHub 存储库部署函数即可。

我的文件结构: https://github.com/Paprika-a11y/pythonfunc.git

  1. 导航到部署中心页面,配置设置: enter image description here
  2. 保存设置后,在 GitHub Action 上检查部署过程: enter image description here
  3. 如果您的函数项目在本地正确,那么它应该出现在门户上: enter image description here

如果您需要工作流程,这里是自动生成的文件:

# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy Python project to Azure Function App - pyfunctemp

on:
  push:
    branches:
      - main
  workflow_dispatch:

env:
  AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
  PYTHON_VERSION: '3.7' # set this to the python version to use (supports 3.6, 3.7, 3.8)

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
    - name: 'Checkout GitHub Action'
      uses: actions/checkout@master

    - name: Setup Python ${{ env.PYTHON_VERSION }} Environment
      uses: actions/setup-python@v1
      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: 'pyfunctemp'
        slot-name: 'production'
        package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
        publish-profile: ${{ secrets.AzureAppService_PublishProfile_xxxxxx }} 

关于azure - 在 GitHub 存储库上同步 python 代码并部署在 Azure 函数上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66303168/

相关文章:

C#:消费计划中的 Azure Functions 中不存在 key 集

c# - 唤醒 Azure 函数

ios - 服务器端Easy Table直接删除,然后客户端同步

Github网站发布不能发布未出生的HEAD

github - 查找漏洞的来源(在 package.json 中)(在 package-lock.json 中)

git - 如何将我当前的项目添加到现有的 GitHub 存储库

Azure 函数 - 报告失败

azure - Powershell + Azure 应用服务 + Azure 容器注册表

c - Azure Iot Hub C 客户端上传到 Blob 因 X.509 身份验证失败

c# - 更新 Azure Blob 上的 LastModified