Skip to content

Commit ec70faa

Browse files
authored
Merge branch 'main' into FlattenLearningCurve_and_AddVisualStudio
2 parents ee09121 + 3c1de20 commit ec70faa

18 files changed

Lines changed: 433 additions & 152 deletions

.env.example

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copy this file to .env and fill in the values.
2+
# .env is gitignored and will never be committed or affect the published site.
3+
4+
# Option 1: Skip all GitHub API calls entirely (fastest local builds, no contributor/commit data).
5+
SKIP_CONTRIBUTORS=true
6+
7+
# Option 2: Use a GitHub Personal Access Token (PAT) for full local builds with real data.
8+
# Generate one at https://github.com/settings/tokens (read:public_repo scope is enough).
9+
# Comment out SKIP_CONTRIBUTORS above and uncomment the line below.
10+
# ACCESS_TOKEN=ghp_your_personal_access_token_here

.nuke/build.schema.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"Deploy",
3232
"PullDnnPackages",
3333
"Restore",
34-
"Serve"
34+
"Serve",
35+
"ValidateGitHubToken"
3536
]
3637
},
3738
"Verbosity": {
@@ -117,6 +118,11 @@
117118
"type": "string",
118119
"description": "Github Token"
119120
},
121+
"Port": {
122+
"type": "integer",
123+
"description": "Port to serve the docs on locally (default: 8085, auto-increments if already in use)",
124+
"format": "int32"
125+
},
120126
"Solution": {
121127
"type": "string",
122128
"description": "Path to a solution file that is automatically loaded"

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,25 @@ Unless you are part of the DNNDocs core team, you will only have read access (yo
3838
### .NET Framework Prerequisites
3939
You should ensure that you already have [.NET 5.0](https://dotnet.microsoft.com/download/dotnet) (used by the `build` project) and the "Developer Pack" for [.NET Framework 4.6.2](https://dotnet.microsoft.com/download/dotnet-framework/net462) (used by the custom `DocFx` plugins) installed on your machine before trying the build process.
4040

41+
### Environment Variables
42+
43+
The build uses a `.env` file in the root of the repository for local configuration. This file is gitignored so it will never be committed. Copy `.env.example` to get started:
44+
45+
```
46+
copy .env.example .env
47+
```
48+
49+
Open `.env` and choose one of two modes:
50+
51+
| Mode | When to use |
52+
|------|-------------|
53+
| `SKIP_CONTRIBUTORS=true` | **Recommended for most contributors.** Skips all GitHub API calls, making local builds much faster. Contributor and last-updated data will be absent from the local preview. |
54+
| `ACCESS_TOKEN=ghp_...` | Use when you need to verify contributor/commit data locally. Generate a token at [github.com/settings/tokens](https://github.com/settings/tokens) with `read:public_repo` scope. |
55+
56+
> **Note:** Without a token and without `SKIP_CONTRIBUTORS=true`, the build will still work but may be slow or hit the GitHub anonymous rate limit.
57+
58+
### Running the build
59+
4160
You should now be able to run the development version of the docs locally with the following command:
4261

4362
Windows Powershell:
@@ -71,6 +90,12 @@ First, it is recommended to create a new branch to collect your changes without
7190
git checkout -b your-branch-name
7291
```
7392

93+
If you made some changes before making a branch (you are on branch **main** and it's dirty), you can switch+create like this:
94+
95+
```
96+
git switch -c your-branch-name
97+
```
98+
7499
Next you can start editing documentation and saving files using your favorite text editor (Visual Studio Code, Atom, Sublime Text, Brackets/Phoenix Code, Notepad++, etc). When you are done with your changes you can verify the modified files. Some code editors will actually show a status of the modified files in their UI. If you want to verify it using the command line you can run the following command:
75100

76101
```

build/Build.cs

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
using System;
22
using System.Linq;
3+
using System.Net;
4+
using System.Net.Http;
5+
using System.Net.Http.Headers;
6+
using System.Net.Sockets;
7+
using System.Threading.Tasks;
38
using Nuke.Common;
49
using Nuke.Common.CI.GitHubActions;
510
using Nuke.Common.IO;
@@ -53,6 +58,9 @@ class Build : NukeBuild
5358
[Parameter("Github Token")]
5459
readonly string GithubToken;
5560

61+
[Parameter("Port to serve the docs on locally (default: 8085, auto-increments if already in use)")]
62+
readonly int Port = 8085;
63+
5664
// Nuke features injection.
5765
[Solution] readonly Solution Solution;
5866
[GitRepository] readonly GitRepository gitRepository;
@@ -132,12 +140,86 @@ class Build : NukeBuild
132140
});
133141

134142
Target Serve => _ => _
143+
.DependsOn(ValidateGitHubToken)
135144
.DependsOn(Clean)
136145
.DependsOn(Restore)
137146
.DependsOn(BuildPlugins)
138147
.Executes(() =>
139148
{
140-
DnnDocFX?.Invoke("--serve --open-browser", RootDirectory);
149+
DnnDocFX?.Invoke($"--serve --open-browser --port {FindFreePort(Port)}", RootDirectory);
150+
});
151+
152+
static int FindFreePort(int startPort)
153+
{
154+
for (var port = startPort; port < startPort + 20; port++)
155+
{
156+
try
157+
{
158+
var listener = new TcpListener(IPAddress.Loopback, port);
159+
listener.Start();
160+
listener.Stop();
161+
return port;
162+
}
163+
catch (SocketException) { }
164+
}
165+
throw new Exception($"Could not find a free port in range {startPort}-{startPort + 19}.");
166+
}
167+
168+
Target ValidateGitHubToken => _ => _
169+
.Executes(async () =>
170+
{
171+
// Load .env file manually (DotNetEnv is not a build project dependency)
172+
var envFile = RootDirectory / ".env";
173+
if (envFile.FileExists())
174+
{
175+
foreach (var line in System.IO.File.ReadAllLines(envFile))
176+
{
177+
if (string.IsNullOrWhiteSpace(line) || line.TrimStart().StartsWith("#")) continue;
178+
var parts = line.Split('=', 2);
179+
if (parts.Length == 2)
180+
Environment.SetEnvironmentVariable(parts[0].Trim(), parts[1].Trim());
181+
}
182+
}
183+
184+
var token = Environment.GetEnvironmentVariable("ACCESS_TOKEN");
185+
if (string.IsNullOrEmpty(token))
186+
token = GithubToken;
187+
188+
if (string.IsNullOrEmpty(token))
189+
{
190+
Serilog.Log.Warning("No GitHub token found. Contributor and commit data will be skipped.");
191+
Serilog.Log.Warning("To enable it, set ACCESS_TOKEN in your .env file (see .env.example).");
192+
Environment.SetEnvironmentVariable("SKIP_CONTRIBUTORS", "true");
193+
return;
194+
}
195+
196+
using var http = new HttpClient();
197+
http.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("DNNDocs-Build", "1.0"));
198+
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
199+
200+
var response = await http.GetAsync("https://api.github.com/user");
201+
202+
if (response.StatusCode == HttpStatusCode.Unauthorized)
203+
Assert.Fail("GitHub token is invalid or has expired. Generate a new one at https://github.com/settings/tokens");
204+
205+
if (!response.IsSuccessStatusCode)
206+
Assert.Fail($"GitHub token validation returned an unexpected status: {(int)response.StatusCode} {response.ReasonPhrase}");
207+
208+
// Check that the token has the required scope
209+
response.Headers.TryGetValues("X-OAuth-Scopes", out var scopeValues);
210+
var scopes = (scopeValues?.FirstOrDefault() ?? string.Empty)
211+
.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
212+
213+
if (scopes.Length > 0 && !scopes.Contains("public_repo") && !scopes.Contains("repo"))
214+
Assert.Fail($"GitHub token is missing the 'public_repo' scope. Current scopes: {string.Join(", ", scopes)}. " +
215+
"Regenerate it at https://github.com/settings/tokens");
216+
217+
var login = await response.Content.ReadAsStringAsync();
218+
var loginStart = login.IndexOf("\"login\":\"") + 9;
219+
var loginEnd = login.IndexOf('"', loginStart);
220+
var username = loginStart > 8 ? login[loginStart..loginEnd] : "unknown";
221+
222+
Serilog.Log.Information("GitHub token is valid. Authenticated as: {Username}", username);
141223
});
142224

143225
Target CreateDeployBranch => _ => _
@@ -151,6 +233,7 @@ class Build : NukeBuild
151233

152234
Target Deploy => _ => _
153235
.OnlyWhenDynamic(() => gitRepository.ToString() == $"https://github.com/{organizationName}/{repositoryName}")
236+
.DependsOn(ValidateGitHubToken)
154237
.DependsOn(CreateDeployBranch)
155238
.DependsOn(Compile)
156239
.Executes(() => {

content/getting-started/setup/upgrades/post-10.2.0-steps.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Before starting the upgrade process, it is recommended to have a very clear unde
1818

1919
* Know the [suggested upgrade path](xref:setup-upgrades-suggested-upgrade-path) and take the necessary planning steps to make each of these upgrade steps for the best success.
2020

21-
* Download the appropriate "Upgrade" ZIP package for your upgrade from [the official repository on GitHub](https://github.com/dnnsoftware/DNN.Platform/releases). The file can be found in the **Assets** section for the desired version release and will have a naming convention like **DNN_Platform_10.2.1_Upgrade.zip**.
21+
* Download the appropriate "Install" ZIP package for your upgrade from [the official repository on GitHub](https://github.com/dnnsoftware/DNN.Platform/releases). The file can be found in the **Assets** section for the desired version release and will have a naming convention like **DNN_Platform_10.3.2_Install.zip**. According to the new upgrade process, upgrade packages will no longer be required.
2222

2323
* Know any changes to the minimum requirements for the desired version of DNN Platform and plan for implementation accordingly.
2424

@@ -45,8 +45,8 @@ If this level of access to the server is not possible, there are other options d
4545
4646
## Step 3 - Upload Upgrade Package
4747
Login as a SuperUser (Host) and navigate to: Settings => Servers => System Info => Upgrades.
48-
Click on "Upload Package" and upload the previously downloaded upgrade zip file.
49-
The system will validate the upgrade package and warn about potential issues if detected.
48+
Click on "Upload Package" and upload the previously downloaded zip file.
49+
The system will validate the install package and warn about potential issues if detected.
5050

5151
## Step 4 - Initiate Upgrade
5252
If the uploaded file is valid, it will be listed and have a "steps" button. Clicking that button will perform any special upgrade steps that DNN may require and then show the upgrade page where you can again login as a SuperUser to start the auto-upgrade process.

content/getting-started/setup/upgrades/suggested-upgrade-path/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ The below is, of course, subject to change. If your current version of DNN Platf
1515

1616
| **FROM Version** | **TO Version** | **Notes** |
1717
|---|---|---|
18-
| [10.02.04] | [10.03.01] | * DNN 10.2.0 introduced a new simplified upgrade process, see [Post-10.2.0 Upgrade Guide](xref:setup-upgrades-post-10.2.0).<br /><br /> * DNN 10.2.3 has an issue with uploading upgrades, if upgrading from 10.2.3, please upload your next version package to `App_Data\Upgrade` folder manually.<br /><br /> |
19-
| [09.13.09] | [10.02.04] | * DNN 10.0.0 is a significant release with both [Breaking Changes and New Features][bc-10], it also introduced minimum requirements for ASP.NET 4.8 and SQL Server 2017. In addition, it will force-remove DNN-Provided Telerik versions.<br /><br /> * DNN 10.1.1 new installs use SHA256 as the default password hashing algorithm. This only affects new installs, if you want to migrate an upgraded site to SHA256, please read [the documentation for membership provider changes](xref:security-membership-providers).<br /><br /> |
18+
| [10.02.05] | [10.03.02] | * DNN 10.2.0 introduced a new simplified upgrade process, see [Post-10.2.0 Upgrade Guide](xref:setup-upgrades-post-10.2.0).<br /><br /> * DNN 10.2.3 has an issue with uploading upgrades, if upgrading from 10.2.3, please upload your next version package to `App_Data\Upgrade` folder manually.<br /><br /> |
19+
| [09.13.09] | [10.02.05] | * DNN 10.0.0 is a significant release with both [Breaking Changes and New Features][bc-10], it also introduced minimum requirements for ASP.NET 4.8 and SQL Server 2017. In addition, it will force-remove DNN-Provided Telerik versions.<br /><br /> * DNN 10.1.1 new installs use SHA256 as the default password hashing algorithm. This only affects new installs, if you want to migrate an upgraded site to SHA256, please read [the documentation for membership provider changes](xref:security-membership-providers).<br /><br /> |
2020
| [09.03.02] | [09.13.09] | * DNN 9.4.0 introduced a minimum requirement of ASP.NET 4.7.2.<br /><br /> * DNN 9.8.0 (and above for the 9.x series releases) brings the OPTIONAL (but HIGHLY RECOMMENDED) [Telerik Removal](xref:setup-telerik-removal).<br /><br /> |
2121
| [09.01.01] | [09.03.02] | * DNN 9.2.0 multiple APIs were removed that were marked deprecated in DNN 7 and before. Most of the core modules have been updated since and you can find them at [dnncommunity][dnncommunity-gh].<br /><br /> * If you have other modules installed, please check for updates before upgrading to DNN 9.2.0 or later.<br /><br /> |
2222
| [08.00.04] | [09.01.01] | |
@@ -34,8 +34,8 @@ The below is, of course, subject to change. If your current version of DNN Platf
3434
| [02.00.04] | [02.01.02] | |
3535

3636
<!-- Version links (DNN Platform releases) -->
37-
[10.03.01]: https://github.com/dnnsoftware/Dnn.Platform/releases/tag/v10.3.1
38-
[10.02.04]: https://github.com/dnnsoftware/Dnn.Platform/releases/tag/v10.2.4
37+
[10.03.02]: https://github.com/dnnsoftware/Dnn.Platform/releases/tag/v10.3.2
38+
[10.02.05]: https://github.com/dnnsoftware/Dnn.Platform/releases/tag/v10.2.5
3939
[09.13.09]: https://github.com/dnnsoftware/Dnn.Platform/releases/tag/v9.13.9
4040
[09.03.02]: https://github.com/dnnsoftware/Dnn.Platform/releases/tag/v9.3.2
4141
[09.01.01]: https://github.com/dnnsoftware/Dnn.Platform/releases/tag/v9.1.1
562 KB
Loading
50.2 KB
Loading
363 KB
Loading
186 KB
Loading

0 commit comments

Comments
 (0)