GSR_DeployEnv ENV variable
This commit is contained in:
@@ -5,6 +5,7 @@ var webDir = Path.GetFullPath(Path.Combine(deployDir, "..", "Web"));
|
|||||||
var webProject = Path.Combine(webDir, "Web.csproj");
|
var webProject = Path.Combine(webDir, "Web.csproj");
|
||||||
var publishDir = Path.Combine(Path.GetTempPath(), "gsr-deploy", Guid.NewGuid().ToString());
|
var publishDir = Path.Combine(Path.GetTempPath(), "gsr-deploy", Guid.NewGuid().ToString());
|
||||||
var deploymentToken = Environment.GetEnvironmentVariable("GSR_DeployToken") ?? throw new InvalidOperationException("GSR_DeployToken environment variable not set.");
|
var deploymentToken = Environment.GetEnvironmentVariable("GSR_DeployToken") ?? throw new InvalidOperationException("GSR_DeployToken environment variable not set.");
|
||||||
|
var deployEnv = Environment.GetEnvironmentVariable("GSR_DeployEnv") ?? "preview";
|
||||||
|
|
||||||
// 1. Publish
|
// 1. Publish
|
||||||
Console.WriteLine("Publishing Web project...");
|
Console.WriteLine("Publishing Web project...");
|
||||||
@@ -19,7 +20,7 @@ if (!Directory.Exists(wwwroot))
|
|||||||
|
|
||||||
// 2. Deploy
|
// 2. Deploy
|
||||||
Console.WriteLine("Deploying to Azure Static Web Apps...");
|
Console.WriteLine("Deploying to Azure Static Web Apps...");
|
||||||
Run("swa.cmd", $"deploy \"{wwwroot}\" --deployment-token \"{deploymentToken}\" --app-location \"{webDir}\"");
|
Run("swa.cmd", $"deploy \"{wwwroot}\" --deployment-token \"{deploymentToken}\" --app-location \"{webDir}\" --env \"{deployEnv}\"");
|
||||||
|
|
||||||
Console.WriteLine("Deploy successful!");
|
Console.WriteLine("Deploy successful!");
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user