-
Notifications
You must be signed in to change notification settings - Fork 6
/
Build.ps1
30 lines (24 loc) · 1.02 KB
/
Build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Install Requirements
Install-Module Pester -MaximumVersion 4.10.1 -Force
Install-Module PSScriptAnalyzer -Force
# Run Unit Tests
Invoke-Pester -EnableExit -OutputFile 'TestResults.xml' -OutputFormat NUnitXml
# Get Module Name
$ModuleName = (Get-Item '*.psd1').Name.Replace('.psd1','')
# Create Build Folder
$BuildFolder = "Build/$ModuleName"
if(!(Test-Path $BuildFolder)){
New-Item -ItemType Directory -Path $BuildFolder
}
# Copy in Items for Release
Copy-Item -Path "$ModuleName.psd1" -Destination $BuildFolder -Force
Copy-Item -Path 'README.md' -Destination $BuildFolder -Force
Copy-Item -Path 'CHANGELOG.md' -Destination $BuildFolder -Force
Copy-Item -Path 'LICENSE.md' -Destination $BuildFolder -Force
# Module Files
Copy-Item -Path '*' -Destination $BuildFolder -Recurse -Include '*.psm1' -Force
# Copy in non-excluded subdirectories
$Directories = Get-ChildItem -Directory -Exclude 'Build','Tests','Icon','Images'
foreach ($Directory in $Directories) {
$Directory | Copy-Item -Destination $BuildFolder -Recurse -Force
}