Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. $OctopusPackage = get-item $OctopusParameters['Octopus.Tentacle.CurrentDeployment.PackageFilePath']
  2.  
  3. #Octopus adds a GUID to the package name when it drops them on disk (i.e MyPackage.20160309.10.nupkg-e9ba4f11-9303-485f-8abc-6ea6c3776588), so you need to get your hands a bit dirty to clean it up:
  4.  
  5. #Dir where the package with the clean name will be dropped
  6. $CopyDir = "C:\TempPackages"
  7. If(!(Test-Path $CopyDir)){
  8. New-Item $CopyDir -ItemType Directory -verbose
  9. }
  10.  
  11.  
  12. #building string of full path of the package you'll be uploading
  13. $PackageToUploadPath = (Join-Path -path $CopyDir -childpath (($OctopusPackage.Name -split "nupkg")[0] + "nupkg"))
  14.  
  15. #Creating the copy with the right name
  16. Copy-Item -Path $OctopusPAckage.FullName -Destination $PackageToUploadPath -Verbose -Force
  17.  
  18. #Here do your magic to push the package to azure using $PackageToUploadPath
  19.  
  20. #Finally delete the copy on disk with the clean name to avoid taking too much space
  21. #Remove-Item $PackageToUploadPath -Verbose
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement