So you have your Umbraco project nicely hooked up to a continuous integration or build server such as TeamCity. So how do you automate the content publishing so your users see the latest version everytime?
At Tekcent we develop Umbraco projects using a shared database as this makes collaboration and working in teams easier. So the following steps is intended for this setup. I will cover the different collaboration options for teams in another blog post.
CI setups are a joy since they can automate the build and deployment process for you. As often during with the development process you will make a bunch of changes to the content database...With a few lines of code you can easily automated publishing from your CI server so you don't have to login to click the "Republish entire website"
Edit the codefile and add some code to call into Umbraco's RefreshContent() method. This will trigger the republishing routine on the server
using System.Web; namespace UmbracoRepublish { /// /// Summary description for RefreshContent /// public class RefreshContent : IHttpHandler { public void ProcessRequest(HttpContext context) { umbraco.library.RefreshContent(); context.Response.ContentType = "text/plain"; context.Response.Write("Content Refreshed"); } public bool IsReusable { get { return false; } } } }
(new-object net.webclient).DownloadString("http://localhost:56713/refreshcontent.ashx")
Saturday June 1, 2013, By Anton Pham