11using System ;
2+ using System . Globalization ;
23using System . IO ;
34using System . Linq ;
45using System . Text ;
@@ -26,6 +27,7 @@ public class DocumentationRunner
2627 private readonly FilePath changelogIndexFile ;
2728 private readonly FilePath changelogFullFile ;
2829 private readonly FilePath changelogTocFile ;
30+ private readonly FilePath lastFooterFile ;
2931
3032 public DocumentationRunner ( BuildContext context )
3133 {
@@ -34,8 +36,8 @@ public DocumentationRunner(BuildContext context)
3436 var docsDirectory = context . RootDirectory . Combine ( "docs" ) ;
3537 changelogDirectory = docsDirectory . Combine ( "changelog" ) ;
3638 changelogSrcDirectory = docsDirectory . Combine ( "_changelog" ) ;
37- docsGeneratedDirectory = docsDirectory . Combine ( "_site" ) ;
3839 changelogDetailsDirectory = changelogSrcDirectory . Combine ( "details" ) ;
40+ docsGeneratedDirectory = docsDirectory . Combine ( "_site" ) ;
3941
4042 redirectFile = docsDirectory . Combine ( "_redirects" ) . CombineWithFilePath ( "_redirects" ) ;
4143 docfxJsonFile = docsDirectory . CombineWithFilePath ( "docfx.json" ) ;
@@ -44,13 +46,16 @@ public DocumentationRunner(BuildContext context)
4446 changelogIndexFile = changelogDirectory . CombineWithFilePath ( "index.md" ) ;
4547 changelogFullFile = changelogDirectory . CombineWithFilePath ( "full.md" ) ;
4648 changelogTocFile = changelogDirectory . CombineWithFilePath ( "toc.yml" ) ;
49+ lastFooterFile = changelogSrcDirectory . Combine ( "footer" )
50+ . CombineWithFilePath ( "v" + context . VersionHistory . CurrentVersion + ".md" ) ;
4751 }
4852
4953 public void Update ( )
5054 {
51- EnsureChangelogDetailsExist ( ) ;
52-
5355 ReadmeUpdater . Run ( context ) ;
56+ UpdateLastFooter ( ) ;
57+
58+ EnsureChangelogDetailsExist ( ) ;
5459
5560 if ( string . IsNullOrEmpty ( GitHubCredentials . Token ) )
5661 throw new Exception ( $ "Environment variable '{ GitHubCredentials . TokenVariableName } ' is not specified!") ;
@@ -79,17 +84,16 @@ public void Update()
7984 }
8085
8186 DocfxChangelogDownload (
82- history . NextVersion ,
87+ history . CurrentVersion ,
8388 history . StableVersions . Last ( ) ,
8489 "HEAD" ) ;
8590 }
8691
87-
8892 public void Prepare ( )
8993 {
9094 foreach ( var version in context . VersionHistory . StableVersions )
9195 DocfxChangelogGenerate ( version ) ;
92- DocfxChangelogGenerate ( context . VersionHistory . NextVersion ) ;
96+ DocfxChangelogGenerate ( context . VersionHistory . CurrentVersion ) ;
9397
9498 GenerateIndexMd ( ) ;
9599 GenerateChangelogIndex ( ) ;
@@ -263,4 +267,27 @@ private void GenerateRedirects()
263267 context . GenerateFile ( fullFilePath , content ) ;
264268 }
265269 }
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+ }
266293}
0 commit comments