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
8 systemctl --user stop www-rouleunpet.service
9
10 git pull
11 cargo build --release
12
13 $destination=$args[0]
14
15 if (!(Test-Path -Path $destination)) {
16    New-Item -ItemType directory -Path $destination
17 }
18
19 strip target/release/rup # To reduce the executable size.
20 Copy-Item target/release/rup -Destination $destination
21 Copy-Item key.secret -Destination $destination
22
23 Copy-Item static -Destination $destination -Recurse -Force
24
25 # Do not overwrite the configuration.
26 if (!(Test-Path -Path $destination/conf.ron)) {
27    Copy-Item conf.ron -Destination $destination
28 }
29
30 systemctl --user start www-rouleunpet.service
31