0

We have a requirement to auto-publish the sitecore items upon success tds deploy.

We are using sitecore.ship /services/publish/smart but it doesn't seem to do any thing at all. The service returns json date which of no use.

  1. Do we need to pass any parameter e.g. root node and credentials?
  2. From which node does it perform smart publish by default?

Are there any other options to perform smart publish using powershell?

Thanks.

  • Hi Nil, can you add more details on your setup? Is it using Azure? Also, follow this link to see all issues with Sitecore.Ship. Might give you an idea if your issue is related. – phani Mar 21 '17 at 6:45
5

I am assuming you are making a web request to the Sitecore Ship endpoint to publish the changes, something similar to this, maybe using Windows PowerShell to invoke the call:

$postUrl = "http://mysite/services/publish/smart"
Invoke-WebRequest $postUrl -Method POST -TimeoutSec 900 -UseBasicParsing

If you check the Sitecore Ship Documentation then the return value of date is the expected value. Note that the call simply kicks off a publish and returns, it does not wait for the publish operation to be finished before handing back control. You can check the Sitecore logs to ensure that the publish operation did start/end as expected.

You can also pass in some additional request values to control publishing:

  • source : The publishing source [default: master]
  • targets : The publishing targets [default: web]
  • languages : The publishing languages [default: en]

Alternatives

  • Fortis Toolcore - adds a web service to Sitecore that will allow you to publish and poll for completion status
  • TDS Post Deploy Step - TDS 5.5 added a new feature to execute Post Deploy Steps. One of the default options is to publish the changes in the package at the end of the package installation. You need to enable this from the Deploy tab of the TDS project properties and add in a list of publish targets.
  • TDS Post Deploy Step with PowerShell - It's also possible to create a custom post deploy action which will in turn trigger Sitecore PowerShell scripts. The scripts can carry out any action you want, including a publish. The scripts themselves can also be managed as part of your TDS package and therefore developers are able to add/update/delete them.
0

To answer your 'perform smart publish using powershell' query below is Powershell script with syntax & example

Syntax:

Publish-Item [-Language <String[]>] [-Path] <String> [-Recurse] [-Target <String[]>] [-PublishMode <Unknown | Full | Incremental | SingleItem | Smart>] [-PublishRelatedItems] [-RepublishAll] [-CompareRevisions] [-FromDate <DateTime>] [-AsJob]

An Example:

A job which does smart publishing all items & related items of siteA tenant to web database

Publish-Item -PublishMode Smart -Path "/sitecore/content/SiteA" -Recurse -Target web -PublishRelatedItems -AsJob 

The real challenge is to execute the script in respective envrn CMs. we have used Octopus(tentacles) in one of our environment to enable CICD.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.