Skip to content

Commit 4a546e4

Browse files
committed
latest changelogs
1 parent d951b88 commit 4a546e4

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

build/Build.cfc

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ component{
7070
docs( argumentCollection=arguments );
7171

7272
// checksums
73-
buildChecksums();
73+
buildChecksums();
74+
75+
// Build latest changelog
76+
latestChangelog();
7477

7578
// Finalize Message
7679
print.line()
@@ -195,7 +198,28 @@ component{
195198
overwrite=true,
196199
recurse=true
197200
);
198-
}
201+
}
202+
203+
/**
204+
* Build the latest changelog file: changelog-latest.md
205+
*/
206+
function latestChangelog(){
207+
print.blueLine( "Building latest changelog..." ).toConsole();
208+
209+
if( !fileExists( variables.cwd & "changelog.md" ) ){
210+
return error( "Cannot continue building, changelog.md file doesn't exist!" );
211+
}
212+
213+
fileWrite(
214+
variables.cwd & "changelog-latest.md",
215+
fileRead( variables.cwd & 'changelog.md' ).split( '----' )[2].trim() & chr( 13 ) & chr( 10 )
216+
);
217+
218+
print
219+
.greenLine( "Latest changelog file created at `changelog-latest.md`" )
220+
.line()
221+
.line( fileRead( variables.cwd & "changelog-latest.md" ) );
222+
}
199223

200224
/********************************************* PRIVATE HELPERS *********************************************/
201225

0 commit comments

Comments
 (0)