我正在使用 Azure DevOps 设置 CI/CD 管道以自动将 React 应用程序部署到多个环境。据我了解,在 npm 构建期间使用了环境变量 (REACT_APP_*)。如何在不为每个环境创建步骤的情况下设置构建阶段?
我正在使用一个带有 React 前端的新ASP.Net Boilerplate项目。
.
这是我目前所拥有的
我在 package.json 中复制了构建任务以允许多个环境
"scripts": {
...
"build": "set REACT_APP_ENV=production && react-app-rewired build --scripts-version react-scripts-ts",
"builduat": "set REACT_APP_ENV=uat && react-app-rewired build --scripts-version react-scripts-ts",
...
}
Run Code Online (Sandbox Code Playgroud)
然后在我的 CI 管道中,我复制了构建任务
- script: yarn builduat
displayName: '[UAT] Yarn build front-end'
workingDirectory: $(WorkingDirectoryReact)
- script: yarn build
displayName: '[PROD] Yarn build front-end'
workingDirectory: $(WorkingDirectoryReact)
Run Code Online (Sandbox Code Playgroud)
我不想为每个环境复制东西,那么理想的解决方案是什么?我真的不想在 CD(部署阶段)期间构建解决方案
continuous-integration multistage reactjs azure-devops aspnetboilerplate
我正在尝试使用VSTS的构建机制来设置持续部署(.NET Core 1.1 Web应用程序).
为此,我按照Microsoft官方文档中显示的步骤操作:
使用VSTS构建并发布到具有持续部署的Azure Web App.
前3个步骤(恢复/发布/ zip)工作没有任何问题.但第四步失败了.我无法将应用程序发布到我的Azure App Service.
这是错误(来自日志):
2016-12-22T14:12:13.1175907Z Got connection details for azureRM WebApp:'devoteamlogin-staging'
2016-12-22T14:12:13.5419583Z Running command: "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:getParameters -source:package="C:\a\1\a\DevoteamLogin.zip" > "C:\a\1\s\parameter.xml"
2016-12-22T14:12:14.8449274Z Error Code: ERROR_EXCEPTION_WHILE_CREATING_OBJECT
2016-12-22T14:12:14.8449274Z More Information: Object of type 'package' and path 'C:\a\1\a\DevoteamLogin.zip' cannot be created. Learn more at:
2016-12-22T14:12:14.8449274Z Error: The Zip package 'C:\a\1\a\DevoteamLogin.zip' could not be loaded.
2016-12-22T14:12:14.8449274Z Error: Package file 'C:\a\1\a\DevoteamLogin.zip' is not in a supported .zip format and therefore cannot be read. …Run Code Online (Sandbox Code Playgroud)