Skip to content

Commit f8faf14

Browse files
committed
Release: edit dist README version on release
Fixes gh-3574
1 parent a31111b commit f8faf14

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

build/release/dist.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ module.exports = function( Release, files, complete ) {
4949
}, null, 2 );
5050
}
5151

52+
/**
53+
* Replace the version in the README
54+
* @param {string} readme
55+
*/
56+
function editReadme( readme ) {
57+
var rprev = new RegExp( Release.prevVersion, "g" );
58+
return readme.replace( rprev, Release.newVersion );
59+
}
60+
5261
/**
5362
* Copy necessary files over to the dist repo
5463
*/
@@ -57,6 +66,7 @@ module.exports = function( Release, files, complete ) {
5766
// Copy dist files
5867
var distFolder = Release.dir.dist + "/dist",
5968
externalFolder = Release.dir.dist + "/external",
69+
readme = fs.readFileSync( Release.dir.dist + "/README.md", "utf8" ),
6070
rmIgnore = files
6171
.concat( [
6272
"README.md",
@@ -93,8 +103,17 @@ module.exports = function( Release, files, complete ) {
93103
// Write generated bower file
94104
fs.writeFileSync( Release.dir.dist + "/bower.json", generateBower() );
95105

96-
console.log( "Adding files to dist..." );
106+
fs.writeFileSync( Release.dir.dist + "/README.md", editReadme( readme ) );
107+
108+
console.log( "Files ready to add." );
109+
console.log( "Edit the dist README.md to include the latest blog post link." );
110+
}
97111

112+
/**
113+
* Add, commit, and tag the dist files
114+
*/
115+
function commit() {
116+
console.log( "Adding files to dist..." );
98117
Release.exec( "git add -A", "Error adding files." );
99118
Release.exec(
100119
"git commit -m \"Release " + Release.newVersion + "\"",
@@ -130,6 +149,10 @@ module.exports = function( Release, files, complete ) {
130149
copy,
131150
Release.confirmReview,
132151

152+
Release._section( "Add, commit, and tag files in distribution repo" ),
153+
commit,
154+
Release.confirmReview,
155+
133156
Release._section( "Pushing files to distribution repo" ),
134157
push
135158
], complete );

0 commit comments

Comments
 (0)