Created
January 24, 2017 09:41
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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