DNS update is now working
[gandi_dns_update.git] / deploy.ps1
diff --git a/deploy.ps1 b/deploy.ps1
new file mode 100644 (file)
index 0000000..eb1a5ea
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/env pwsh
+
+if ($args.Count -lt 1) {
+   $scriptName = [Environment]::GetCommandLineArgs()[1]
+   Write-Output "Usage: $scriptName <destination>"
+   exit 1
+}
+
+git pull
+cargo build --release
+
+systemctl --user stop gandi_dns_update
+
+$destination=$args[0]
+
+if (!(Test-Path -Path $destination)) {
+   New-Item -ItemType directory -Path $destination
+}
+
+strip target/release/gandi_dns_update # To reduce the executable size.
+Copy-Item target/release/gandi_dns_update -Destination $destination
+
+# Do not overwrite the configuration.
+if (!(Test-Path -Path $destination/config.ron)) {
+   Copy-Item backend/config.ron -Destination $destination
+}
+
+systemctl --user start gandi_dns_update