tag:help.appveyor.com,2012-11-13:/discussions/questions/25548-how-to-deploy-different-artifacts-to-multiple-environments-from-single-deployAppVeyor: Discussion 2018-09-09T02:41:49Ztag:help.appveyor.com,2012-11-13:Comment/460043172018-09-01T04:30:36Z2018-09-01T04:30:36ZHow to deploy different artifacts to multiple environments from single deploy<div><p>There are 2 options available:</p>
<p>We could help you come up with a script solution. You would provide build number and which artifact to deploy and the script would call deployments via the api.</p>
<p>Or, if you are ok with using last successful build as default then you could have a use a <em>deployment project</em> approach as detailed <a href="https://www.appveyor.com/blog/2015/11/04/deployment-projects/">here</a>. Don't let the blog post scare you, its not too complicated an idea. No need for new repository, you can simply have a separate config file in the same repository named <code>deploy.yml</code> for instance and then set a custom yaml name for that project in the AppVeyor UI.</p>
<p>Feel free to ask any questions regarding details of either approach.</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/460043172018-09-01T11:39:13Z2018-09-01T11:39:13ZHow to deploy different artifacts to multiple environments from single deploy<div><p>Thank your for your reply. I had a feeling that this would require a custom script solution. Based on the two options I would go for the first one and sacrifice the "deploy-from-ui" solution that we use today.</p>
<p>Do you have any sample scripts (powershell preferably) using your api that does something like this?</p>
<ol>
<li>Deploy first artifact X from build Y to environment Z<br></li>
<li>Wait for success for step 1 (I guess this would require some polling of the deployment status using your api?)<br></li>
<li>When step 1 has succeeded then deploy second artifact X from build Y to environment Z<br></li>
<li>Wait for success for step 3.<br></li>
<li>Done!</li>
</ol></div>alexandertag:help.appveyor.com,2012-11-13:Comment/460043172018-09-07T01:07:39Z2018-09-07T01:07:39ZHow to deploy different artifacts to multiple environments from single deploy<div><p>Sorry for the delay. I have a script and approach that should work for you, or at least get you started.</p>
<p>You will need to create 2 different environments, one for each of the artifacts you want to deploy.<br>
Then you can call <a href="https://gist.github.com/OwenMcDonnell/d1676c6a6d0b59f0c8c2d03b37881d8e">this script</a>, passing in each environment name (in order of dependent artifacts to deploy) and the build version as parameters. Other parameters (account name and project slug) can be hard coded or you can parameterize them if you prefer.</p>
<p>If you have any more questions or need any clarification don't hesitate to ask.</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/460043172018-09-08T05:31:32Z2018-09-08T05:31:32ZHow to deploy different artifacts to multiple environments from single deploy<div><p>Thank you for this script, excellent support. However, I have already implemented something similar using the very same API) just a few days ago. I can verify this works very well for our needs. This script will be great for others to review and modify for their needs.</p></div>alexandertag:help.appveyor.com,2012-11-13:Comment/460043172018-09-09T02:41:46Z2018-09-09T02:41:46ZHow to deploy different artifacts to multiple environments from single deploy<div><p>Great. As long as you have something that works for you!</p></div>Owen McDonnell