Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions tools/PackModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,26 @@ if($PSCmdlet.ParameterSetName -eq "GraphResource"){
}
$PackModulePS1 = Join-Path $ModuleProjLocation "/pack-module.ps1"

# Pack module
& $PackModulePS1
if($LASTEXITCODE) {
Write-Error "Failed to pack '$Module' module."
}
if (Test-Path $PackModulePS1) {
# Pack module
& $PackModulePS1
if($LASTEXITCODE) {
Write-Error "Failed to pack '$Module' module."
}

# Get generated .nupkg
$NuGetPackage = (Get-ChildItem (Join-Path $ModuleProjLocation "./bin") | Where-Object Name -Match ".nupkg").FullName
# Get generated .nupkg
$NuGetPackage = (Get-ChildItem (Join-Path $ModuleProjLocation "./bin") | Where-Object Name -Match ".nupkg").FullName

$ModuleArtifactLocation = "$ArtifactsLocation\$Module"
if(-not (Test-Path $ModuleArtifactLocation)) {
New-Item -Path $ModuleArtifactLocation -Type Directory
} else {
Remove-Item -Path "$ModuleArtifactLocation\*" -Recurse -Force
}
$ModuleArtifactLocation = "$ArtifactsLocation\$Module"
if(-not (Test-Path $ModuleArtifactLocation)) {
New-Item -Path $ModuleArtifactLocation -Type Directory
} else {
Remove-Item -Path "$ModuleArtifactLocation\*" -Recurse -Force
}

# Copy package to artifacts folder.
Write-Host -ForegroundColor Green "Copying '$NuGetPackage' to $ModuleArtifactLocation..."
Copy-Item -Path $NuGetPackage -Destination $ModuleArtifactLocation -Force
# Copy package to artifacts folder.
Write-Host -ForegroundColor Green "Copying '$NuGetPackage' to $ModuleArtifactLocation..."
Copy-Item -Path $NuGetPackage -Destination $ModuleArtifactLocation -Force

Write-Host -ForegroundColor Green "-------------Done-------------"
Write-Host -ForegroundColor Green "-------------Done-------------"
}