Automated Publish Module

Publishing restrictions are great they allow you to specify what date and time an item or version is publishable. This meets the use case where you might be creating content for your Christmas campaign and don't want it to go live until the 1st of December (or October if the current shop displays and adverts are anything to go by :S).
The only issue with this is you have to manually publish after the time specified to get the content live.
A common ask is for that content to go live out of normal office hours, say 00:01. Out of the box that would require someone to log in and hit publish. I was looking for something that would do this automatically.

Two options spring to mind, but both have disadvantages:

1. Run a publish scheduled task at a defined interval, say 1hr. This will get the content live at the time you want, however the downsides are that it will publish any content that's publishable regardless of restrictions, it’s not only as accurate as the interval, and it’s going to publish all day every day unless you manually turn it on and off, so there's a performance consideration on the content management instance.

2. Create a windows scheduled task to call a publish page or a web service, you could use Curl and SitecoreShip (https://github.com/kevinobee/Sitecore.Ship) I've used this in the past for continuous delivery. This is more accurate but the downsides is that it requires server access to define the schedule and as above its not selective and will publish anything that’s publishable at that point in time.

I wanted something more accurate, selective and something that requires minimal user interaction.
I took a look on the Sitecore marketplace and found this:

https://marketplace.sitecore.net/en/Modules/Automated_Publisher.aspx

It seemed to do everything I wanted, it works as below:

There’s a custom save event, when a publish restriction is set and saved, it creates a custom auto publish task for the item. It sets the task to start at the time defined in publishing restrictions and run for one day. There’s a publish class that calls a publish and cleans the task up after it has been run.
It works for both publish start and publish end date times, and at both item and item version level.
Pretty cool stuff.

The only issue was that the module on marketplace is a little outdated (compatible to 6.5) so I've took it upon myself to update it. 
It required a change as it currently compares the date with DateTime.Now not DateTime.UtcNow (Cheers Steve McGill)
I've upped the course to bring it in-line with Sitecore 8.2 and tested and it works as expected.

You can find the source code here:

https://github.com/BIGANDYT/AutomatedPublisherSource

The package compatible with 8.2 is here:

https://github.com/BIGANDYT/AutomatedPublisherSource/raw/master/data/packages/Automated_Publisher-1.1.zip

Credit to Joel Konecny and  David DeBruin for the module. I've passed all this over to Joel so they can update the Marketplace page.

Comments

Popular posts from this blog

Sitecore Unicorn standard values field child ID warnings

Sitecore DMS and Analytics Considerations

Sitecore Continuous Integration DMS and the Marketing Centre