mirror of
https://github.com/MichaelGrafnetter/DSInternals
synced 2025-02-19 12:36:53 +00:00
Added file catalog to packages
This commit is contained in:
parent
3da4233034
commit
58b90fcea7
@ -2,11 +2,24 @@
|
||||
.SYNOPSIS
|
||||
Generates a Chocolatey package. Requires Chocolatey to be installed.
|
||||
#>
|
||||
#Requires -Version 3
|
||||
#Requires -Version 5
|
||||
|
||||
$repoRoot = Join-Path $PSScriptRoot '..\'
|
||||
$nuspecPath = Join-Path $repoRoot 'Src\DSInternals.PowerShell.Chocolatey\dsinternals.nuspec'
|
||||
$nuspecPath = Join-Path $repoRoot 'Src\DSInternals.PowerShell.Chocolatey\DSInternals.nuspec'
|
||||
$outputDir = Join-Path $repoRoot 'Build\packages\Chocolatey'
|
||||
$moduleDir = Join-Path $repoRoot 'Build\bin\Release\DSInternals'
|
||||
|
||||
# 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)
|
||||
{
|
||||
New-FileCatalog -CatalogFilePath $catalogPath -Path $moduleDir -CatalogVersion 1.0 -ErrorAction Stop | Out-Null
|
||||
}
|
||||
|
||||
# Create target folder
|
||||
mkdir $outputDir -Force | Out-Null
|
||||
|
||||
# Pack using Chocolatey
|
||||
choco pack $nuspecPath --outputdirectory $outputDir
|
@ -23,7 +23,7 @@ if(-not (Test-Path $nuget))
|
||||
}
|
||||
|
||||
# Pack all *.csproj files that have a corresponding *.nuspec file
|
||||
Get-ChildItem -Path $repoRoot -Filter *.nuspec -Recurse -File |
|
||||
Get-ChildItem -Path $repoRoot -Filter *.nuspec -Exclude DSInternals.nuspec -Recurse -File |
|
||||
ForEach-Object { $PSItem.FullName.Replace('.nuspec', '.csproj') } |
|
||||
ForEach-Object {
|
||||
$solutionFile = $PSItem
|
||||
|
@ -1,18 +1,30 @@
|
||||
#Requires -Version 5
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Creates a ZIP file distribution of the DSInternals module.
|
||||
It is presumed that the moduel has already been compiled.
|
||||
It is presumed that the module has already been compiled.
|
||||
#>
|
||||
|
||||
#Requires -Version 5
|
||||
|
||||
# Set paths
|
||||
$rootDir = Split-Path $PSScriptRoot -Parent
|
||||
$releaseDir = Join-Path $rootDir 'Build\bin\Release'
|
||||
$moduleDir = Join-Path $rootDir 'Build\bin\Release\DSInternals'
|
||||
$targetDir = Join-Path $rootDir 'Build\packages\Module'
|
||||
|
||||
# Retrieve module version from manifest
|
||||
$manifestPath = Join-Path $releaseDir 'DSInternals\DSInternals.psd1'
|
||||
# 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)
|
||||
{
|
||||
New-FileCatalog -CatalogFilePath $catalogPath -Path $moduleDir -CatalogVersion 1.0 -ErrorAction Stop | Out-Null
|
||||
}
|
||||
|
||||
# Retrieve module version from the manifest
|
||||
$manifestPath = Join-Path $moduleDir 'DSInternals.psd1'
|
||||
$moduleVersion = Test-ModuleManifest -Path $manifestPath -ErrorAction Stop | select -ExpandProperty Version
|
||||
$archiveName = 'DSInternals_v{0}.zip' -f $moduleVersion
|
||||
|
||||
# Create the target ZIP archive
|
||||
Compress-Archive -Path $releaseDir\* $releaseDir\$archiveName -Force
|
||||
New-Item -Path $targetDir -ItemType Directory -Force | Out-Null
|
||||
Compress-Archive -Path $moduleDir,$catalogPath -DestinationPath $targetDir\$archiveName -Force -ErrorAction Stop
|
@ -4,7 +4,7 @@
|
||||
<metadata>
|
||||
<id>DSInternals</id>
|
||||
<version>3.4</version>
|
||||
<packageSourceUrl>https://github.com/MichaelGrafnetter/DSInternals</packageSourceUrl>
|
||||
<packageSourceUrl>https://github.com/MichaelGrafnetter/DSInternals/tree/master/Src/DSInternals.PowerShell.Chocolatey</packageSourceUrl>
|
||||
<owners>MichaelGrafnetter</owners>
|
||||
<title>DSInternals PowerShell Module</title>
|
||||
<authors>Michael Grafnetter</authors>
|
||||
@ -51,5 +51,6 @@
|
||||
<files>
|
||||
<file src="tools\**" target="tools" />
|
||||
<file src="..\..\Build\bin\Release\DSInternals\**" target="DSInternals" />
|
||||
<file src="..\..\Build\bin\Release\DSInternals.cat" target="tools\DSInternals.cat" />
|
||||
</files>
|
||||
</package>
|
||||
|
@ -3,3 +3,9 @@
|
||||
This is the official DSInternals PowerShell Module Chocolatey package.
|
||||
|
||||
The package is self-contained and contains the same files as the GitHub ZIP release (https://github.com/MichaelGrafnetter/DSInternals/releases).
|
||||
|
||||
File integrity can be checked against the catalog file using the following PowerShell 5 command:
|
||||
|
||||
Test-FileCatalog -CatalogFilePath tools\DSInternals.cat -Path DSInternals -Detailed
|
||||
|
||||
Note that the catalog file is not digitally signed (for now).
|
||||
|
Loading…
Reference in New Issue
Block a user