Skip to content

Commit

Permalink
Made deployer ensure target folders exist
Browse files Browse the repository at this point in the history
before deploying so it should hopefully now work finally
  • Loading branch information
hhyyrylainen committed Jan 6, 2025
1 parent 7925938 commit 4cf5b91
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions Scripts/Deployer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,24 @@ private async Task<bool> CopyFiles(string targetFolder, CancellationToken cancel
await BlazorBootFileHandler.RegenerateCompressedFiles(destination, cancellationToken);
}

var clientTarget = Path.Join(targetFolder, "www");
var serverTarget = Path.Join(targetFolder, "server");

try
{
Directory.CreateDirectory(clientTarget);
Directory.CreateDirectory(serverTarget);
}
catch (Exception e)
{
ColourConsole.WriteErrorLine($"Failed to create install target folders: {e}");
return false;
}

var startInfo = new ProcessStartInfo("rsync");
startInfo.ArgumentList.Add("-hr");
startInfo.ArgumentList.Add(ClientBuiltWebroot);
startInfo.ArgumentList.Add(Path.Join(targetFolder, "www") + "/");
startInfo.ArgumentList.Add(clientTarget + "/");
startInfo.ArgumentList.Add("--delete");

ColourConsole.WriteNormalLine("Copying client files");
Expand All @@ -434,14 +448,15 @@ private async Task<bool> CopyFiles(string targetFolder, CancellationToken cancel

if (result.ExitCode != 0)
{
ColourConsole.WriteErrorLine("Failed to copy files");
ColourConsole.WriteNormalLine(result.FullOutput);
ColourConsole.WriteErrorLine("Failed to copy files (see above for output)");
return false;
}

startInfo = new ProcessStartInfo("rsync");
startInfo.ArgumentList.Add("-hr");
startInfo.ArgumentList.Add(ServerBuiltBase);
startInfo.ArgumentList.Add(Path.Join(targetFolder, "server") + "/");
startInfo.ArgumentList.Add(serverTarget + "/");
startInfo.ArgumentList.Add("--delete");
startInfo.ArgumentList.Add("--exclude");
startInfo.ArgumentList.Add("wwwroot");
Expand Down

0 comments on commit 4cf5b91

Please sign in to comment.