Merge branch 'master' of euphorik.ch:rup into master
[rup.git] / deploy.ps1
1 if ($args.Count -lt 1) {
2    $scriptName = [Environment]::GetCommandLineArgs()[1]
3    Write-Output "Usage: $scriptName <destination>"
4    exit 1
5 }
6
7 git pull
8 cargo build --release
9
10 systemctl --user stop www-rouleunpet.service
11
12 $destination=$args[0]
13
14 if (!(Test-Path -Path $destination)) {
15    New-Item -ItemType directory -Path $destination
16 }
17
18 strip target/release/rup # To reduce the executable size.
19 Copy-Item target/release/rup -Destination $destination
20 Copy-Item key.secret -Destination $destination
21
22 Copy-Item static -Destination $destination -Recurse -Force
23
24 # Do not overwrite the configuration.
25 if (!(Test-Path -Path $destination/conf.ron)) {
26    Copy-Item conf.ron -Destination $destination
27 }
28
29 systemctl --user start www-rouleunpet.service
30