[英]Deploy the Gulp Build Folder To Azure from Visual Studio Team Services
I just started using VSO for one of my project. 我刚刚开始将VSO用于我的一个项目。 I have created the built definition and the built was successful.
我已经创建了构建定义,并且构建成功。 When I tried to create the release definition for that built its failing by throwing the error
当我尝试为该版本创建发布定义时,通过引发错误而失败
System.Management.Automation.RuntimeException: No files were found to deploy with search pattern C:\a\858bddd5b\**\*.zip
Its expecting .zip files. 其预期的.zip文件。 Since I need to deploy the distributed folder created by gulp build, I have given the Web Deploy Package path as
由于我需要部署由gulp build创建的分布式文件夹,因此我将Web Deploy Package路径指定为
$(System.DefaultWorkingDirectory)/{built name}
Any help is really appreciated 任何帮助都非常感谢
You should add a build step to create an archive with .zip extension for the output folder of the gulp step. 您应该添加一个构建步骤,以为gulp步骤的输出文件夹创建一个扩展名为.zip的存档。 Your steps should look like
您的步骤应如下所示
VSO/VSTS build has a task available with Archive files
to achieve the same. VSO / VSTS构建具有
Archive files
可用的任务以实现相同目的。
Alternatively, if the standard Archive files step doesn't work for you, you can use a powershell step. 另外,如果标准存档文件步骤对您不起作用,则可以使用Powershell步骤。 The powershell command will look like the following.
powershell命令将如下所示。
[io.compression.zipfile]::CreateFromDirectory($Source, $Destination)
You can also use this extension to create a ZIP file. 您也可以使用此扩展名来创建一个ZIP文件。 I used it for a situation similar to yours:
我将其用于与您类似的情况:
https://marketplace.visualstudio.com/items?itemName=trackyon.trackyonadvantage https://marketplace.visualstudio.com/items?itemName=trackyon.trackyon优点
"Azure Web App Deployment" task requires a web deploy zip package. “ Azure Web App部署”任务需要Web部署zip软件包。 You can either add one more task to create a zip package for the build output as other two answers indicated or add some code in your "gulpfile.js" to generate a zip package during the gulp build and then publish the zip package to artifact.
您可以添加另一个任务来为构建输出创建一个zip包,如其他两个答案所示,或者在gulpfile.js中添加一些代码以在gulp生成期间生成一个zip包,然后将该zip包发布到工件。
If you don't want to create a zip package for the build output, then you can use FTP Uploader task to deploy the build to Azure Web App via FTP Deploy . 如果您不想为构建输出创建一个zip包,则可以使用FTP Uploader任务通过FTP Deploy将构建部署到Azure Web App。
You can create a zip file with PowerShell, assuming you're running on a Windows agent. 假设您正在Windows代理上运行,则可以使用PowerShell创建一个zip文件。
Command Line
task Command Line
任务
Command: powershell
Arguments: -Command "&{Add-Type -assembly 'system.io.compression.filesystem'; [io.compression.zipfile]::CreateFromDirectory('$(Build.StagingDirectory)\\Zip', '$(Build.StagingDirectory)\\$(BuildConfiguration)Deploy.zip')}"
命令:
powershell
参数:- -Command "&{Add-Type -assembly 'system.io.compression.filesystem'; [io.compression.zipfile]::CreateFromDirectory('$(Build.StagingDirectory)\\Zip', '$(Build.StagingDirectory)\\$(BuildConfiguration)Deploy.zip')}"
Obviously, replace $(Build.StagingDirectory)\\Zip
with whatever folder you want zipped up and $(Build.StagingDirectory)\\$(BuildConfiguration)Deploy.zip
with whatever you want the file named. 显然,将
$(Build.StagingDirectory)\\Zip
替换$(Build.StagingDirectory)\\Zip
您要压缩的文件夹,将$(Build.StagingDirectory)\\$(BuildConfiguration)Deploy.zip
为您想要的文件名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.