public async Task <StepActionResult> Publish(Guid id, SyncPublisherAction action, ActionArguments args) { if (args?.Options == null) { throw new ArgumentNullException(nameof(args)); } if (id == Guid.Empty) { id = Guid.NewGuid(); } var dependencies = outgoingService.GetItemDependencies(args.Options.Items, args.Callbacks); MoveToNextStep(action, args); // generate the razor for all the pages GenerateHtml(dependencies, id, args); MoveToNextStep(action, args); // grab all the media that is referenced in all the pages GatherMedia(dependencies, id, args); MoveToNextStep(action, args); // get the system files (css/scripts/etc) GatherFiles(dependencies, id, args); MoveToNextStep(action, args); // put this somewhere Publish(id, args); return(await Task.FromResult(new StepActionResult(true, id, args.Options, Enumerable.Empty <uSyncAction>()))); }
public Task <StepActionResult> Publish( Guid id, SyncPublisherAction action, ActionArguments args) { if (args?.Options == null) { throw new ArgumentNullException(nameof(args)); } try { if (id == Guid.Empty) { id = Guid.NewGuid(); } var config = _publisherSearchConfigs.ConfigsByServerName.TryGetValue(args.Target, out var sc) ? sc : null; _staticSitePublisherExtensions.Keys.ToList().ForEach(e => _staticSitePublisherExtensions[e] = e.BeginPublish(id, _syncRoot, action, args, config)); var itemDependencies = _outgoingService.GetItemDependencies(args.Options.Items, args.Callbacks)?.ToList() ?? new List <uSyncDependency>(); var itemPaths = new Dictionary <string, string>(itemDependencies.Count) { [new GuidUdi(Umbraco.Core.Constants.UdiEntityType.Document, Guid.Empty).ToString()] = "/" }; RunExtension((e, s) => e.AddCustomDependencies(s, itemDependencies)); MoveToNextStep(action, args); GenerateHtml(itemDependencies, id, args, itemPaths); MoveToNextStep(action, args); GatherMedia(itemDependencies, id, args); MoveToNextStep(action, args); GatherFiles(id, args); RunExtension((e, s) => e.BeforeFinalPublish(s)); MoveToNextStep(action, args); Publish(id, args, config, itemPaths); RunExtension((e, s) => e.EndPublish(s)); var result = new StepActionResult(true, id, args.Options, Enumerable.Empty <uSyncAction>()); return(Task.FromResult(result)); } catch (Exception ex) { logger.Error <ExtensibleStaticPublisher>(ex, $"Could not publish"); throw; } }