Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jammykam/6730f85e60e011df720d5d0e8c2a258d to your computer and use it in GitHub Desktop.
Save jammykam/6730f85e60e011df720d5d0e8c2a258d to your computer and use it in GitHub Desktop.
TDS Post-Deploy Step to generate anti-update rollback package - http://wp.me/p2SmN4-fh
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using HedgehogDevelopment.SitecoreProject.PackageInstallPostProcessor.Contracts;
using Sitecore.Diagnostics;
namespace ForwardSlash.TDS.PostDeploy
{
[Description("Generate anti-update rollback package for latest deployment.")]
public class GenerateRollback : IPostDeployAction
{
public void RunPostDeployAction(XDocument deployedItems, IPostDeployActionHost host, string parameter)
{
string tempFolder = Sitecore.Update.Utils.FileUtils.InstallationHistoryRoot;
string historyFolder = Sitecore.MainUtil.MapPath(tempFolder);
//get the latest update folder
var latestFolder = new DirectoryInfo(historyFolder).GetDirectories()
.OrderByDescending(d => d.LastWriteTimeUtc).First();
Sitecore.Update.Engine.PackageGenerator.ConvertRollbackPackage(
latestFolder.FullName + "\\rollbackPackage.rlb",
latestFolder.FullName + "\\rollbackPackage.update");
Log.Info("[TDS Post-Deploy] :: Generated rollback file for deployment to " + latestFolder.FullName, this);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment