Update dependencies
[valheim_web.git] / deploy.ps1
1 #!/usr/bin/env pwsh
2
3 if ($args.Count -lt 1) {
4    $scriptName = [Environment]::GetCommandLineArgs()[1]
5    Write-Output "Usage: $scriptName <destination>"
6    exit 1
7 }
8
9 git pull
10 cargo build --release
11
12 systemctl --user stop valheim_web
13
14 $destination=$args[0]
15
16 if (!(Test-Path -Path $destination)) {
17    New-Item -ItemType directory -Path $destination
18 }
19
20 strip target/release/valheim_web # To reduce the executable size.
21 Copy-Item target/release/valheim_web -Destination $destination
22
23 Copy-Item backend/static -Destination $destination -Recurse -Force -Exclude style.css.map
24
25 # Do not overwrite the configuration.
26 if (!(Test-Path -Path $destination/conf.ron)) {
27    Copy-Item backend/conf.ron -Destination $destination
28 }
29
30 systemctl --user start valheim_web
31