gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 03:52:04 25 4
gpt4 key购买 nike

我想同步代码(在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com