【发布时间】:2021-01-17 04:46:49
【问题描述】:
我有一个简单的 react 应用程序,我正在尝试将其部署到 azure web 应用程序。一些关键点。
- Web 应用程序已在 Azure 中配置。
- Web 应用程序的发布配置文件已包含在 GitHub 存储库中
我正在使用以下 GitHub 工作流代码。
on: push
env:
AZURE_WEBAPP_NAME: ReactJSRecipeAppGitHubActionsOct12020 # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
NODE_VERSION: '10.x' # set this to the node version to use
jobs:
build-and-deploy:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: npm install, build, and test
run: |
# Build and test the project, then
# deploy to Azure Web App.
npm install
npm run build --if-present
npm run test --if-present
- name: 'Deploy to Azure WebApp'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
整个工作流程运行没有任何问题。一切都是绿色的。代码和部署作业都是公开的。你可以在这里看到整个事情 - https://github.com/Jay-study-nildana/APIServerDotNetCoreGitActionsCICD
很遗憾,这不起作用,因为包含要服务的实际网站的“build”文件夹没有部署在网站的根目录。
在当前状态下,存储库的整个根目录都部署到目标 Web 应用程序,包括构建文件夹。如果我打开 KUDU 控制台,我可以看到构建文件夹和站点的所有内容。
那么,问题是,我如何获得上述工作流程,以放置“构建”文件夹的内容,而不是整个 repo?
另外,请注意以下几点。
-
我已经为 AZURE_WEBAPP_PACKAGE_PATH 变量尝试了以下不同的选项,但它们都不起作用。
-
'/构建'
-
'./build/.'
-
/构建'
-
'./build/'
【问题讨论】:
标签: azure-devops github-actions