Created
May 1, 2017 22:40
-
-
Save chedabob/6227e19c96de7fd0782a4abd452cd0f3 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
$ReleaseNumber = $OctopusParameters['Octopus.Release.Number'] | |
$SourceDirectoryName = $OctopusParameters['Octopus.Action[Deploy Live Package].Output.Package.InstallationDirectoryPath'] | |
$WorkingFolder = $env:temp + "\\<redacted>-aws-live-" + $ReleaseNumber | |
$PayloadFolder = $WorkingFolder + "\\payload" | |
$SiteFilePath = $WorkingFolder + "\\payload\\site.zip" | |
$PayloadOutput = $WorkingFolder + "\\payload.zip" | |
If (Test-Path $WorkingFolder){ | |
Remove-Item $WorkingFolder -Recurse -Force | |
} | |
New-Item -Path $WorkingFolder -ItemType directory | |
New-Item -Path $PayloadFolder -ItemType directory | |
$CompressionLevel = "Fast" | |
$IncludeBaseDirectory = 0 | |
Write-Host "Creating Zip file $SiteFilePath with the contents of directory $SourceDirectoryName using compression level $CompressionLevel" | |
[Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") | |
[System.IO.Compression.ZipFile]::CreateFromDirectory($SourceDirectoryName, $SiteFilePath, $CompressionLevel, $IncludeBaseDirectory) | |
$Manifest = '{ | |
"manifestVersion": 1, | |
"deployments": { | |
"aspNetCoreWeb": [ | |
{ | |
"name": "dotnet-core-tutorial", | |
"parameters": { | |
"appBundle": "site.zip", | |
"iisPath": "/", | |
"iisWebSite": "Default Web Site" | |
} | |
} | |
] | |
} | |
}' | |
$Manifest | Out-File ($PayloadFolder + "\\aws-windows-deployment-manifest.json ") | |
[System.IO.Compression.ZipFile]::CreateFromDirectory($PayloadFolder, $PayloadOutput, $CompressionLevel, $IncludeBaseDirectory) | |
Set-OctopusVariable -name "PayloadPath" -value $PayloadOutput |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment