Configures deployment to netlify

This commit is contained in:
Phil Scott 2022-02-14 14:01:19 -05:00 committed by Patrik Svensson
parent c2da268129
commit 3ac63d2670
5 changed files with 10 additions and 15 deletions

View File

@ -39,6 +39,7 @@
<PackageReference Include="Statiq.Common" Version="1.0.0-beta.56" /> <PackageReference Include="Statiq.Common" Version="1.0.0-beta.56" />
<PackageReference Include="Statiq.Web" Version="1.0.0-beta.42" /> <PackageReference Include="Statiq.Web" Version="1.0.0-beta.42" />
<PackageReference Include="MinVer" PrivateAssets="All" Version="2.3.1" /> <PackageReference Include="MinVer" PrivateAssets="All" Version="2.3.1" />
<PackageReference Include="Statiq.Web.Netlify" Version="1.0.0-beta.42" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -34,7 +34,6 @@ namespace Docs
i.AddSingleton(new TypeNameLinks()); i.AddSingleton(new TypeNameLinks());
}) })
.ConfigureSite("spectreconsole", "spectre.console", "main") .ConfigureSite("spectreconsole", "spectre.console", "main")
.ConfigureDeployment(deployBranch: "docs")
.AddShortcode("Children", typeof(ChildrenShortcode)) .AddShortcode("Children", typeof(ChildrenShortcode))
.AddShortcode("ColorTable", typeof(ColorTableShortcode)) .AddShortcode("ColorTable", typeof(ColorTableShortcode))
.AddShortcode("EmojiTable", typeof(EmojiTableShortcode)) .AddShortcode("EmojiTable", typeof(EmojiTableShortcode))

View File

@ -42,8 +42,8 @@ namespace Docs
public static class Deployment public static class Deployment
{ {
public const string GitHubToken = "GITHUB_TOKEN"; public const string NetlifySiteId = "NETLIFY_SITE_ID";
public const string TargetBranch = "DEPLOYMENT_TARGET_BRANCH"; public const string NetlifyAccessToken = "NETLIFY_ACCESS_TOKEN";
} }
} }
} }

View File

@ -1,5 +1,6 @@
using Statiq.App; using Statiq.App;
using Statiq.Common; using Statiq.Common;
using Statiq.Web;
namespace Docs.Extensions namespace Docs.Extensions
{ {
@ -15,11 +16,5 @@ namespace Docs.Extensions
} }
return bootstrapper; return bootstrapper;
} }
public static Bootstrapper ConfigureDeployment(this Bootstrapper bootstrapper, string deployBranch)
{
bootstrapper?.AddSetting(Constants.Deployment.TargetBranch, deployBranch);
return bootstrapper;
}
} }
} }

View File

@ -1,5 +1,6 @@
using Statiq.Common; using Statiq.Common;
using Statiq.Web.GitHub; using Statiq.Web.GitHub;
using Statiq.Web.Netlify;
namespace Docs.Pipelines namespace Docs.Pipelines
{ {
@ -10,12 +11,11 @@ namespace Docs.Pipelines
Deployment = true; Deployment = true;
OutputModules = new ModuleList OutputModules = new ModuleList
{ {
new DeployGitHubPages( new DeployNetlifySite(
Config.FromSetting<string>(Constants.Site.Owner), siteId: Config.FromSetting<string>(Constants.Deployment.NetlifySiteId),
Config.FromSetting<string>(Constants.Site.Repository), accessToken: Config.FromSetting<string>(Constants.Deployment.NetlifyAccessToken)
Config.FromSetting<string>(Constants.Deployment.GitHubToken)) )
.ToBranch(Config.FromSetting<string>(Constants.Deployment.TargetBranch))
}; };
} }
} }
} }