Created
July 13, 2016 16:30
-
-
Save Alex-Yates/65d2fb1e38050412e6c771f39baaf683 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Write-Output "***************************" | |
Write-Output "***** EXTRACT PACKAGE *****" | |
Write-Output "***************************" | |
$pipeline = ${env:PIPELINE_NUMBER}.trim() | |
$nuget = "C:\RelativePath\JenkinsBuildArtifacts\MySchema.0.${pipeline}.nupkg" | |
$destination = "$env:WORKSPACE\extractedNuGet" | |
Write-Output "Using the following variables:" | |
Write-Output "pipeline: $pipeline" | |
Write-Output "nuget: $nuget" | |
Write-Output "destination: $destination" | |
# Clean the destination directory. | |
If (Test-Path $destination) { | |
rmdir $destination -Recurse -Force | |
} | |
# Extract the NuGet package | |
# Code copied from http://stackoverflow.com/questions/24672560/most-elegant-way-to-extract-a-directory-from-a-zipfile-using-powershell | |
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') | |
[IO.Compression.ZipFile]::ExtractToDirectory($nuget, $destination) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment