forked from NuGet/NuGetGallery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Deploy-StaticContent.ps1 (NuGet#3529)
- Loading branch information
Scott Bommarito
authored
Feb 11, 2017
1 parent
4b99fbf
commit 2ed3fee
Showing
2 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[CmdletBinding(DefaultParameterSetName='RegularBuild')] | ||
param ( | ||
[string]$StorageAccountName, | ||
[string]$StorageAccountKey, | ||
[string]$Environment | ||
) | ||
|
||
Write-Host "Uploading static $Environment gallery content to $StorageAccountName." | ||
|
||
[System.Reflection.Assembly]::LoadFrom("C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.9\bin\Microsoft.WindowsAzure.StorageClient.dll") | ||
|
||
$account = [Microsoft.WindowsAzure.CloudStorageAccount]::Parse("DefaultEndpointsProtocol=https;AccountName=$StorageAccountName;AccountKey=$StorageAccountKey") | ||
$client = [Microsoft.WindowsAzure.StorageClient.CloudStorageAccountStorageClientExtensions]::CreateCloudBlobClient($account) | ||
|
||
$files = Get-ChildItem ".\content\$Environment" | ||
foreach ($file in $files) { | ||
$blob = $client.GetBlockBlob("content/$file") | ||
try { | ||
$snappy = $blob.CreateSnapshot() | ||
Write-Host "Created snapshot of existing 'content/$file'." | ||
} catch {} | ||
$blob.UploadFile($file.FullName) | ||
Write-Host "Uploaded 'content/$file'." | ||
} |
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