Created
September 3, 2019 15:23
-
-
Save izharikov/f0fdb71560325b038b2345fae6b1835b to your computer and use it in GitHub Desktop.
CreateSitecorePackage.ps1
This file contains 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
function CreateSitecorePackage() { | |
param( | |
[string]$Name, | |
[string]$Author = "Igor Zharikov", | |
[string]$Publisher = "SEGB", | |
[string]$Version = "1.0", | |
[array]$Paths | |
) | |
$package = New-Package $Name; | |
# Set package metadata | |
$package.Sources.Clear(); | |
$package.Metadata.Author = $Author; | |
$package.Metadata.Publisher = $Publisher; | |
$package.Metadata.Version = $Version; | |
foreach ($Path in $Paths){ | |
$item = Get-Item -Path $Path | |
$package.Sources.Add( $(New-ItemSource -Item $item -Name $Path -InstallMode Overwrite) ) | |
} | |
$PackageName = "$($package.Name)-$($package.Metadata.Version).zip" | |
Export-Package -Project $package -Path $PackageName -Zip | |
# Offer the user to download the package | |
Download-File "$SitecorePackageFolder\$PackageName" | |
} | |
$pathsToIncludeInPackage = @( | |
"/sitecore/content/SharedContent/SEGBDictionary/CampaignResources/SelectButton", | |
"/sitecore/media library/SmartEnergy/print-resource-images/asset-icons/asset-people-icon", | |
"/sitecore/media library/SmartEnergy/print-resource-images/asset-icons/asset-star-icon", | |
"/sitecore/media library/SmartEnergy/print-resource-images/asset-icons/asset-truck-icon" | |
) | |
CreateSitecorePackage -Name "ResourceCentreUpdates" -Version "15.0" -Paths $pathsToIncludeInPackage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment