Skip to content

Commit

Permalink
Configures deployment to netlify
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-scott-78 authored and patriksvensson committed Feb 14, 2022
1 parent c2da268 commit 3ac63d2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
1 change: 1 addition & 0 deletions docs/Docs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<PackageReference Include="Statiq.Common" Version="1.0.0-beta.56" />
<PackageReference Include="Statiq.Web" Version="1.0.0-beta.42" />
<PackageReference Include="MinVer" PrivateAssets="All" Version="2.3.1" />
<PackageReference Include="Statiq.Web.Netlify" Version="1.0.0-beta.42" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion docs/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions docs/src/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
}
7 changes: 1 addition & 6 deletions docs/src/Extensions/BootstrapperExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Statiq.App;
using Statiq.Common;
using Statiq.Web;

namespace Docs.Extensions
{
Expand All @@ -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;
}
}
}
12 changes: 6 additions & 6 deletions docs/src/Pipelines/DeploymentPipeline.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Statiq.Common;
using Statiq.Web.GitHub;
using Statiq.Web.Netlify;

namespace Docs.Pipelines
{
Expand All @@ -10,12 +11,11 @@ public DeploymentPipeline()
Deployment = true;
OutputModules = new ModuleList
{
new DeployGitHubPages(
Config.FromSetting<string>(Constants.Site.Owner),
Config.FromSetting<string>(Constants.Site.Repository),
Config.FromSetting<string>(Constants.Deployment.GitHubToken))
.ToBranch(Config.FromSetting<string>(Constants.Deployment.TargetBranch))
new DeployNetlifySite(
siteId: Config.FromSetting<string>(Constants.Deployment.NetlifySiteId),
accessToken: Config.FromSetting<string>(Constants.Deployment.NetlifyAccessToken)
)
};
}
}
}
}

0 comments on commit 3ac63d2

Please sign in to comment.