Skip to content

Instantly share code, notes, and snippets.

@Alex-Yates
Created July 13, 2016 16:30
Show Gist options
  • Save Alex-Yates/65d2fb1e38050412e6c771f39baaf683 to your computer and use it in GitHub Desktop.
Save Alex-Yates/65d2fb1e38050412e6c771f39baaf683 to your computer and use it in GitHub Desktop.
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