forked from stride3d/stride-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.ps1
More file actions
32 lines (25 loc) · 1.39 KB
/
deploy.ps1
File metadata and controls
32 lines (25 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
param ($deploymentProfile, $deploymentPassword)
# This is the version used in the https://doc.stride3d.net/<version> url
# Please update this if branching for a new release!
$version = "4.1"
# Deploy doc on the target
Write-Host Executing `'WAWSDeploy.exe ../stride_doc.zip $deploymentProfile /v /t $version /d /p XXXXXXXXXXXXX`'
./WAWSDeploy.exe ../stride_doc.zip $deploymentProfile /v /t $version /d /p $deploymentPassword
# Find host URL from deployment profile
[xml]$deploymentProfileXml = Get-Content $deploymentProfile
$deployUrl = $deploymentProfileXml.publishData.publishProfile[0].destinationAppUrl
# Process versions.json
Write-Host Updating list of versions
$response = Invoke-RestMethod -Uri $deployUrl/versions.json
$response.versions = ($response.versions + $version) | select -Unique | Sort-Object -Property @{Expression={ new-object System.Version ($_) }; Descending = $True}
# Save file
New-Item -Name "_siteroot" -ItemType "directory"
$response | ConvertTo-Json | Out-File -Encoding ascii "_siteroot/versions.json"
# Only update web.config if we are the latest version
if ($response.versions[0] -eq $version)
{
(Get-Content -path "web.config" -Raw) -Replace '%deployment_version%', $version | Set-Content -Encoding utf8 -Path "_siteroot\web.config"
}
# Upload versions.json and web.config
./WAWSDeploy.exe _siteroot $deploymentProfile /v /p $deploymentPassword
Remove-Item "_siteroot" -Recurse