1
1
using System ;
2
+ using System . Globalization ;
2
3
using System . IO ;
3
4
using System . Linq ;
4
5
using System . Text ;
@@ -26,6 +27,7 @@ public class DocumentationRunner
26
27
private readonly FilePath changelogIndexFile ;
27
28
private readonly FilePath changelogFullFile ;
28
29
private readonly FilePath changelogTocFile ;
30
+ private readonly FilePath lastFooterFile ;
29
31
30
32
public DocumentationRunner ( BuildContext context )
31
33
{
@@ -34,8 +36,8 @@ public DocumentationRunner(BuildContext context)
34
36
var docsDirectory = context . RootDirectory . Combine ( "docs" ) ;
35
37
changelogDirectory = docsDirectory . Combine ( "changelog" ) ;
36
38
changelogSrcDirectory = docsDirectory . Combine ( "_changelog" ) ;
37
- docsGeneratedDirectory = docsDirectory . Combine ( "_site" ) ;
38
39
changelogDetailsDirectory = changelogSrcDirectory . Combine ( "details" ) ;
40
+ docsGeneratedDirectory = docsDirectory . Combine ( "_site" ) ;
39
41
40
42
redirectFile = docsDirectory . Combine ( "_redirects" ) . CombineWithFilePath ( "_redirects" ) ;
41
43
docfxJsonFile = docsDirectory . CombineWithFilePath ( "docfx.json" ) ;
@@ -44,13 +46,16 @@ public DocumentationRunner(BuildContext context)
44
46
changelogIndexFile = changelogDirectory . CombineWithFilePath ( "index.md" ) ;
45
47
changelogFullFile = changelogDirectory . CombineWithFilePath ( "full.md" ) ;
46
48
changelogTocFile = changelogDirectory . CombineWithFilePath ( "toc.yml" ) ;
49
+ lastFooterFile = changelogSrcDirectory . Combine ( "footer" )
50
+ . CombineWithFilePath ( "v" + context . VersionHistory . CurrentVersion + ".md" ) ;
47
51
}
48
52
49
53
public void Update ( )
50
54
{
51
- EnsureChangelogDetailsExist ( ) ;
52
-
53
55
ReadmeUpdater . Run ( context ) ;
56
+ UpdateLastFooter ( ) ;
57
+
58
+ EnsureChangelogDetailsExist ( ) ;
54
59
55
60
if ( string . IsNullOrEmpty ( GitHubCredentials . Token ) )
56
61
throw new Exception ( $ "Environment variable '{ GitHubCredentials . TokenVariableName } ' is not specified!") ;
@@ -79,17 +84,16 @@ public void Update()
79
84
}
80
85
81
86
DocfxChangelogDownload (
82
- history . NextVersion ,
87
+ history . CurrentVersion ,
83
88
history . StableVersions . Last ( ) ,
84
89
"HEAD" ) ;
85
90
}
86
91
87
-
88
92
public void Prepare ( )
89
93
{
90
94
foreach ( var version in context . VersionHistory . StableVersions )
91
95
DocfxChangelogGenerate ( version ) ;
92
- DocfxChangelogGenerate ( context . VersionHistory . NextVersion ) ;
96
+ DocfxChangelogGenerate ( context . VersionHistory . CurrentVersion ) ;
93
97
94
98
GenerateIndexMd ( ) ;
95
99
GenerateChangelogIndex ( ) ;
@@ -263,4 +267,27 @@ private void GenerateRedirects()
263
267
context . GenerateFile ( fullFilePath , content ) ;
264
268
}
265
269
}
270
+
271
+ private void UpdateLastFooter ( )
272
+ {
273
+ var version = context . VersionHistory . CurrentVersion ;
274
+ var previousVersion = context . VersionHistory . StableVersions . Last ( ) ;
275
+ var date = context . VersionStable
276
+ ? DateTime . Now . ToString ( "MMMM dd, yyyy" , CultureInfo . InvariantCulture )
277
+ : "TBA" ;
278
+
279
+ var content = new StringBuilder ( ) ;
280
+ content . AppendLine ( $ "_Date: { date } _") ;
281
+ content . AppendLine ( "" ) ;
282
+ content . AppendLine (
283
+ $ "_Milestone: [v{ version } ](https://github.com/dotnet/BenchmarkDotNet/issues?q=milestone%3Av{ version } )_") ;
284
+ content . AppendLine (
285
+ $ "([List of commits](https://github.com/dotnet/BenchmarkDotNet/compare/v{ previousVersion } ...v{ version } ))") ;
286
+ content . AppendLine ( "" ) ;
287
+ content . AppendLine ( "_NuGet Packages:_" ) ;
288
+ foreach ( var packageName in context . NuGetPackageNames )
289
+ content . AppendLine ( $ "* https://www.nuget.org/packages/{ packageName } /{ version } ") ;
290
+
291
+ context . GenerateFile ( lastFooterFile , content ) ;
292
+ }
266
293
}
0 commit comments