-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.ps1
More file actions
executable file
·33 lines (24 loc) · 1.1 KB
/
deploy.ps1
File metadata and controls
executable file
·33 lines (24 loc) · 1.1 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
33
#!/usr/bin/pwsh
param (
[switch] $Debug,
[switch] $NoClean,
[switch] $NoConfigurationValidation
)
$environment = $Debug ? 'debug' : 'production'
$deployConfigurationFile = Join-Path 'config' $environment 'deploy.json'
$isDeployConfigurationValid = $NoConfigurationValidation -or (& (Join-Path '.' 'config' 'test.ps1') -PassThru -ConfigurationFile $deployConfigurationFile)
if (!$isDeployConfigurationValid) {
exit
}
'Deploying...' | Out-Host
$deployConfiguration = Get-Content $deployConfigurationFile | ConvertFrom-Json
$remoteHostName = $deployConfiguration.host
$remotePort = $deployConfiguration.port
$remoteUserName = $deployConfiguration.user
$remotePath = $deployConfiguration.path
$remotePathDelimiter = $deployConfiguration.isWindows ? '\' : '/'
$remotePortArgs = $remotePort ? @( '-p', $remotePort ) : @()
$noCleanArg = $NoClean ? '-NoClean' : ''
"Connecting to $remoteHostName..." | Out-Host
& ssh -t "$remoteUserName@$remoteHostName" @remotePortArgs "pwsh -WorkingDirectory $remotePath -File ${remotePath}${remotePathDelimiter}upgrade.ps1 $noCleanArg"
'Deployment completed' | Out-Host