Skip to content

Instantly share code, notes, and snippets.

@marcduiker
Created October 31, 2015 23:56
Show Gist options
  • Save marcduiker/6e3ada7efad84dc418b7 to your computer and use it in GitHub Desktop.
Save marcduiker/6e3ada7efad84dc418b7 to your computer and use it in GitHub Desktop.
<#
This function uploads & installs the specified Sitecore update package to the given $SiteUrl.
It uses cURL (http://curl.haxx.se/) to post a request to a Sitecore website which has Sitecore Ship installed.
Example usage:
.\deploy-sitecorepackage.ps1 mysite.dev "C:\Project\Build\Artifacts\1-mysite-templates.update" 60 300
#>
Param(
[Parameter(Position=0, Mandatory=$true)]
[string]$SiteUrl,
[Parameter(Position=1, Mandatory=$true)]
[string]$UpdatePackagePath,
[Parameter(Position=2)]
[ValidateRange(0, 99999)]
[int]$ConnectionTimeOutInSeconds = 300,
[Parameter(Position=3)]
[ValidateRange(0, 99999)]
[int]$MaxTimeOutInSeconds = 900
)
$fileUploadUrl = "$SiteUrl/services/package/install/fileupload"
$curlPath = .\get-curlpath.ps1
$curlCommand= "$curlPath --show-error --silent --connect-timeout $ConnectionTimeOutInSeconds --max-time $MaxTimeOutInSeconds --form ""filename=@$UpdatePackagePath"" $fileUploadUrl"
Write-Output "INFO: Starting Invoke-Expression: $curlCommand"
Invoke-Expression $curlCommand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment