简体   繁体   中英

Deploy the Gulp Build Folder To Azure from Visual Studio Team Services

I just started using VSO for one of my project. 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. Since I need to deploy the distributed folder created by gulp build, I have given the Web Deploy Package path as

$(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. Your steps should look like

在此处输入图片说明

VSO/VSTS build has a task available with Archive files to achieve the same.

Alternatively, if the standard Archive files step doesn't work for you, you can use a powershell step. The powershell command will look like the following.

[io.compression.zipfile]::CreateFromDirectory($Source, $Destination) 
  • Source should be all the files/folders from gulp output you wish to deploy
  • Destination here should correspond to input for the webdeploy/ WebApp deployment step.

You can also use this extension to create a ZIP file. I used it for a situation similar to yours:

https://marketplace.visualstudio.com/items?itemName=trackyon.trackyonadvantage

"Azure Web App Deployment" task requires a web deploy zip package. 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.

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 .

You can create a zip file with PowerShell, assuming you're running on a Windows agent.

Command Line task

Command: powershell Arguments: -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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM