【发布时间】:2021-04-06 04:56:09
【问题描述】:
我有一个功能应用程序,它基本上从网络上抓取数据。这是一个长期运行的,通常每天需要9个小时。 我已经配置了推送事件以通过 GitHub Actions 构建和部署。
问题:当我们将任何更改推送到 GitHub 并且函数应用程序正在运行时,它会造成混乱,因为正在运行的函数将在部署后停止并触发。
我希望在每次推送时部署解决方案,但仅在函数应用未运行时部署。
yml 文件内容:
name: dev-workflow
on:
push:
branches:
- main
env:
AZURE_FUNCTIONAPP_NAME: test-github-actions
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.'
PYTHON_VERSION: '3.7'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main
- 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: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.PUBLISH_PROFILE }}
【问题讨论】:
标签: github azure-functions github-actions