設定連續部署Set up continuous deployment

適用于: SDK v4APPLIES TO: SDK v4

本文將示範如何設定 Bot 的持續部署。This article shows you how to configure continuous deployment for your bot. 您可以啟用持續部署,自動將來源存放庫中的程式碼變更部署至 Azure。You can enable continuous deployment to automatically deploy code changes from your source repository to Azure. 在本主題中,我們將討論如何設定 GitHub 的持續部署。In this topic, we'll cover setting up continuous deployment for GitHub. 若要了解其他原始檔控制系統的持續部署設定,請參閱此頁面底部的 [其他資源] 區段。For information on setting up continuous deployment with other source control systems, see the additional resource section at the bottom of this page.

PrerequisitesPrerequisites

準備您的存放庫Prepare your repository

確定您的存放庫根目錄含有專案中的正確檔案。Make sure that your repository root has the correct files in your project. 這可讓您從組建提供者取得自動建置。This will allow you to get automatic builds from the build provider.

執行階段Runtime 根目錄檔案Root directory files
ASP.NET CoreASP.NET Core .sln 或 .csproj.sln or .csproj
Node.jsNode.js 含啟動指令碼的 server.js、app.js 或 package.jsonserver.js, app.js, or package.json with a start script
PythonPython app.pyapp.py

使用 GitHub 進行持續部署Continuous deployment using GitHub

若要啟用搭配 GitHub 的持續部署,請巡覽至 Azure 入口網站中適用您 Bot 的 App Service 頁面。To enable continuous deployment with GitHub, navigate to the App Service page for your bot in the Azure portal.

  1. 按一下 [部署中心] > [GitHub] > [授權]。Click Deployment Center > GitHub > Authorize.

    持續部署

    1. 在開啟的瀏覽器視窗中,按一下 [授權 AzureAppService]。In the browser window that opens up, click Authorize AzureAppService.

      Azure Github 權限

    2. 在授權 AzureAppService 後,返回 Azure 入口網站中的 部署中心After authorizing the AzureAppService, go back to Deployment Center in the Azure portal.

  2. 按一下 [繼續]Click Continue.

    繼續處理組建提供者Continue to build provider

  3. 在 [組建提供者] 頁面上選取您想要使用的組建提供者,然後按一下 [繼續]。On the Build provider page, select the build provider you want to use and click Continue.

  4. 在 [設定] 頁面上,輸入必要資訊,然後按一下 [繼續]。On the Configure page, enter the required information and click Continue. 所需的資訊將取決於您選擇的原始檔控制服務和組建提供者。The information required will depend on which source control service and build provider you chose.

  5. 在 [摘要] 頁面上,檢閱設定,然後按一下 [完成]。On the Summary page, review the settings and then click Finish.

此時,搭配 GitHub 的持續部署已設定完成。At this point, continuous deployment with GitHub is set up. 所選取存放庫和分支中的新認可,現在會持續部署到 App Service 應用程式。New commits in the selected repository and branch now deploy continuously into your App Service app. 您可以在 [部署中心] 頁面上追蹤認可和部署。You can track the commits and deployments on the Deployment Center page.

停用連續部署Disable continuous deployment

設定 Bot 以進行持續部署時,您可能不會使用線上程式碼編輯器來變更 Bot。While your bot is configured for continuous deployment, you may not use the online code editor to make changes to your bot. 如果您想要使用線上程式碼編輯器,可以暫時停用持續部署。If you want to use the online code editor, you can temporarily disable continuous deployment.

若要停用持續部署,請執行下列作業:To disable continuous deployment, do the following:

  1. Azure 入口網站中,請移至 Bot 的 [所有 App Service 設定] 刀鋒視窗,然後按一下 [部署中心]。In the Azure portal, go to your bot's All App Service settings blade and click Deployment Center.
  2. 按一下 [中斷連線],停用持續部署。Click Disconnect to disable continuous deployment. 若要重新啟用持續部署,請重複上述適當章節的步驟。To re-enable continuous deployment, repeat the steps from the appropriate sections above.

其他資源Additional resources

  • 如需在 Azure 中持續部署的詳細資訊,請參閱持續部署至 Azure App ServiceFor more information about continuous deployment in Azure, see continuous deployment to Azure App Service.
  • 當您針對組建提供者使用 GitHub 動作時,會在您的存放庫中建立工作流程。When you use GitHub actions for the build provider, a workflow is created in your repository. 您可以在 GitHub 網站上深入了解使用 GitHub 動作You can learn more about using GitHub Actions on the GitHub site.