-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathsetup.ps1
More file actions
58 lines (50 loc) · 1.77 KB
/
setup.ps1
File metadata and controls
58 lines (50 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Check if not in a CI environment
if (-not (Test-Path Env:CI)) {
# Initialize the server submodule
Write-Host "Initializing and updating submodules..."
git submodule init
if ($LASTEXITCODE -eq 0) {
git submodule update --recursive
} else {
Write-Error "git submodule init failed."
exit 1
}
if ($LASTEXITCODE -ne 0) {
Write-Error "git submodule update --recursive failed."
exit 1
}
# Install the workloads
Write-Host "Restoring dotnet workloads..."
dotnet workload restore
if ($LASTEXITCODE -ne 0) {
Write-Error "dotnet workload restore failed."
exit 1
}
}
# Create appsettings file to include app plugin when running the server
$appsettings = "submodules/btcpayserver/BTCPayServer/appsettings.dev.json"
if (-not (Test-Path $appsettings -PathType Leaf)) {
Write-Host "Creating $appsettings..."
$content = '{ "DEBUG_PLUGINS": "../../../BTCPayServer.Plugins.App/bin/Debug/net8.0/BTCPayServer.Plugins.App.dll" }'
Set-Content -Path $appsettings -Value $content -Encoding UTF8
}
# Publish plugin to share its dependencies with the server
$originalLocation = Get-Location
$pluginDir = "BTCPayServer.Plugins.App"
if (Test-Path $pluginDir) {
Write-Host "Changing directory to $pluginDir..."
Set-Location $pluginDir
Write-Host "Publishing plugin..."
dotnet publish -c Debug -o "bin/Debug/net8.0"
if ($LASTEXITCODE -ne 0) {
Write-Error "dotnet publish failed."
Set-Location $originalLocation # Ensure we return to original location on error
exit 1
}
Write-Host "Returning to original directory..."
Set-Location $originalLocation
} else {
Write-Error "Plugin directory $pluginDir not found."
exit 1
}
Write-Host "Setup complete."