From 3ac63d2670d02c1ccd2a609fa67070fa73919bed Mon Sep 17 00:00:00 2001 From: Phil Scott Date: Mon, 14 Feb 2022 14:01:19 -0500 Subject: [PATCH] Configures deployment to netlify --- docs/Docs.csproj | 1 + docs/Program.cs | 1 - docs/src/Constants.cs | 4 ++-- docs/src/Extensions/BootstrapperExtensions.cs | 7 +------ docs/src/Pipelines/DeploymentPipeline.cs | 12 ++++++------ 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/docs/Docs.csproj b/docs/Docs.csproj index ded6bac2d..459f8a944 100644 --- a/docs/Docs.csproj +++ b/docs/Docs.csproj @@ -39,6 +39,7 @@ + diff --git a/docs/Program.cs b/docs/Program.cs index 1e2a19b9f..a7f857672 100644 --- a/docs/Program.cs +++ b/docs/Program.cs @@ -34,7 +34,6 @@ await Bootstrapper.Factory i.AddSingleton(new TypeNameLinks()); }) .ConfigureSite("spectreconsole", "spectre.console", "main") - .ConfigureDeployment(deployBranch: "docs") .AddShortcode("Children", typeof(ChildrenShortcode)) .AddShortcode("ColorTable", typeof(ColorTableShortcode)) .AddShortcode("EmojiTable", typeof(EmojiTableShortcode)) diff --git a/docs/src/Constants.cs b/docs/src/Constants.cs index 87ae0dba1..42b2e487a 100644 --- a/docs/src/Constants.cs +++ b/docs/src/Constants.cs @@ -42,8 +42,8 @@ public static class Site public static class Deployment { - public const string GitHubToken = "GITHUB_TOKEN"; - public const string TargetBranch = "DEPLOYMENT_TARGET_BRANCH"; + public const string NetlifySiteId = "NETLIFY_SITE_ID"; + public const string NetlifyAccessToken = "NETLIFY_ACCESS_TOKEN"; } } } diff --git a/docs/src/Extensions/BootstrapperExtensions.cs b/docs/src/Extensions/BootstrapperExtensions.cs index c8f77a8b7..cea29c0e7 100644 --- a/docs/src/Extensions/BootstrapperExtensions.cs +++ b/docs/src/Extensions/BootstrapperExtensions.cs @@ -1,5 +1,6 @@ using Statiq.App; using Statiq.Common; +using Statiq.Web; namespace Docs.Extensions { @@ -15,11 +16,5 @@ public static Bootstrapper ConfigureSite(this Bootstrapper bootstrapper, string } return bootstrapper; } - - public static Bootstrapper ConfigureDeployment(this Bootstrapper bootstrapper, string deployBranch) - { - bootstrapper?.AddSetting(Constants.Deployment.TargetBranch, deployBranch); - return bootstrapper; - } } } diff --git a/docs/src/Pipelines/DeploymentPipeline.cs b/docs/src/Pipelines/DeploymentPipeline.cs index 9ebd6f3c1..298804a2e 100644 --- a/docs/src/Pipelines/DeploymentPipeline.cs +++ b/docs/src/Pipelines/DeploymentPipeline.cs @@ -1,5 +1,6 @@ using Statiq.Common; using Statiq.Web.GitHub; +using Statiq.Web.Netlify; namespace Docs.Pipelines { @@ -10,12 +11,11 @@ public DeploymentPipeline() Deployment = true; OutputModules = new ModuleList { - new DeployGitHubPages( - Config.FromSetting(Constants.Site.Owner), - Config.FromSetting(Constants.Site.Repository), - Config.FromSetting(Constants.Deployment.GitHubToken)) - .ToBranch(Config.FromSetting(Constants.Deployment.TargetBranch)) + new DeployNetlifySite( + siteId: Config.FromSetting(Constants.Deployment.NetlifySiteId), + accessToken: Config.FromSetting(Constants.Deployment.NetlifyAccessToken) + ) }; } } -} +} \ No newline at end of file