Skip to content

Instantly share code, notes, and snippets.

@jvanderbiest
Created December 20, 2014 12:43
Show Gist options
  • Save jvanderbiest/c5d61748fd67c0e449a3 to your computer and use it in GitHub Desktop.
Save jvanderbiest/c5d61748fd67c0e449a3 to your computer and use it in GitHub Desktop.
Organize Drop Artifacts for Codit.Blog.JsVsoBuild
Write-Host "Executing Script OrganizeDropArtifacts"
$PackageFolder = $env:TF_BUILD_BINARIESDIRECTORY + "\Package"
new-item $PackageFolder -itemtype directory
Write-Host "Created new folder $PackageFolder"
# Copy package directories + rename (generic for all packages)
Get-ChildItem -Path $env:TF_BUILD_BINARIESDIRECTORY -Filter "*_Package" -Recurse | Where-Object { $_.Attributes -eq "Directory"} | ForEach-Object {
Write-Host $_.FullName
$dest = $_.Name -replace "_Package", ""
Move-Item -LiteralPath $_.FullName -Destination "$PackageFolder\$dest" }
# Copy our Javascript test output
New-Item -Path "$env:TF_BUILD_BINARIESDIRECTORY\Javascript_Output\" -Type Directory
Write-Host "Created new folder $env:TF_BUILD_BINARIESDIRECTORY\Javascript_Output\"
$from = $env:TF_BUILD_SOURCESDIRECTORY + "\tests\*"
$to = $env:TF_BUILD_BINARIESDIRECTORY + "\Javascript_Output\"
Write-Host "Start copy items from: $from to: $to"
Copy-Item $from $to -Recurse
# Remove all other trash
Get-ChildItem -Path $env:TF_BUILD_BINARIESDIRECTORY -Recurse -exclude somefile.txt |
Select -ExpandProperty FullName |
Where {$_ -notlike $PackageFolder + '*' -AND $_ -notlike $env:TF_BUILD_BINARIESDIRECTORY + '\logs*' -AND $_ -notlike $env:TF_BUILD_BINARIESDIRECTORY + '\Javascript_Output*' }|
sort length -Descending |
Remove-Item -force -Recurse
Write-Host "Finished Script OrganizeDropArtifacts"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment