DSInternals/Scripts/Pack-Chocolatey.ps1

25 lines
955 B
PowerShell
Raw Normal View History

2019-05-08 15:35:52 +00:00
<#
.SYNOPSIS
Generates a Chocolatey package. Requires Chocolatey to be installed.
#>
2019-05-08 17:19:05 +00:00
#Requires -Version 5
2019-05-08 15:35:52 +00:00
2019-05-09 13:35:30 +00:00
$repoRoot = Join-Path $PSScriptRoot '..\' -Resolve
2019-05-10 21:12:10 +00:00
$nuspecPath = Join-Path $repoRoot 'Src\DSInternals.PowerShell\Chocolatey\*.nuspec' -Resolve
2019-05-08 15:35:52 +00:00
$outputDir = Join-Path $repoRoot 'Build\packages\Chocolatey'
2019-05-08 17:19:05 +00:00
$moduleDir = Join-Path $repoRoot 'Build\bin\Release\DSInternals'
2019-05-08 15:35:52 +00:00
2019-05-08 17:19:05 +00:00
# Generate file catalog
$catalogPath = Join-Path $moduleDir '..\DSInternals.cat'
$catalogIsValid = (Test-Path -Path $catalogPath) -and
(Test-FileCatalog -CatalogFilePath $catalogPath -Path $moduleDir) -eq [System.Management.Automation.CatalogValidationStatus]::Valid
if(-not $catalogIsValid)
{
2019-05-09 13:35:30 +00:00
New-FileCatalog -CatalogFilePath $catalogPath -Path $moduleDir -CatalogVersion 1.0 -ErrorAction Stop
2019-05-08 17:19:05 +00:00
}
# Create target folder
2019-05-09 13:35:30 +00:00
mkdir $outputDir -Force
2019-05-08 17:19:05 +00:00
# Pack using Chocolatey
2019-05-09 13:35:30 +00:00
choco pack $nuspecPath --outputdirectory $outputDir --timeout 60 --confirm --verbose