Split in modules
[gandi_dns_update.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 gandi_dns_update
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/gandi_dns_update # To reduce the executable size.
21 Copy-Item target/release/gandi_dns_update -Destination $destination
22
23 # Do not overwrite the configuration.
24 if (!(Test-Path -Path $destination/config.ron)) {
25    Copy-Item config.ron -Destination $destination
26 }
27
28 systemctl --user start gandi_dns_update