forked from PoshCode/PSGit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPackage.ps1
More file actions
30 lines (23 loc) · 1.06 KB
/
Copy pathPackage.ps1
File metadata and controls
30 lines (23 loc) · 1.06 KB
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
[CmdletBinding()]
param(
[Alias("PSPath")]
[string]$Path = $PSScriptRoot,
[string]$ModuleName = $(Split-Path $Path -Leaf),
[Nullable[int]]$RevisionNumber = ${Env:APPVEYOR_BUILD_NUMBER}
)
$OutputPath = Join-Path $Path output
$null = mkdir $OutputPath -Force
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest
Write-Host "TESTING: $ModuleName with $Path\Test"
$Version = &"${PSScriptRoot}\Get-Version.ps1" -Module (Join-Path $Path\src "${ModuleName}.psd1") -DevBuild:$RevisionNumber -RevisionNumber:$RevisionNumber
$ReleasePath = Join-Path $Path $Version
Write-Verbose "COPY $ReleasePath\"
$null = robocopy $ReleasePath "${OutputPath}\${ModuleName}" /MIR /NP /LOG+:"$OutputPath\build.log"
$zipFile = Join-Path $OutputPath "${ModuleName}-${Version}.zip"
Add-Type -assemblyname System.IO.Compression.FileSystem
Remove-Item $zipFile -ErrorAction SilentlyContinue
Write-Verbose "ZIP $zipFile"
[System.IO.Compression.ZipFile]::CreateFromDirectory((Join-Path $OutputPath $ModuleName), $zipFile)
# You can add other artifacts here
ls $OutputPath -File