Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Release: Added custom release script
Browse files Browse the repository at this point in the history
  • Loading branch information
gseguin committed Dec 13, 2013
1 parent ae370cd commit d65396b
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 18 deletions.
65 changes: 51 additions & 14 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ module.exports = function( grunt ) {
dirs = {
dist: dist,
cdn: {
noversion: path.join( dist, "cdn-noversion" ),
google: path.join( dist, "cdn-google" ),
jquery: path.join( dist, "cdn" ),
git: path.join( dist, "git" )
},
tmp: path.join( dist, "tmp" )
Expand Down Expand Up @@ -185,7 +186,7 @@ module.exports = function( grunt ) {

distZipOut: path.join( dist, name + "<%= versionSuffix %>.zip" ),

cdnNoversionZipOut: path.join( "<%= dirs.cdn.noversion %>","<%= files.zipFileName %>" )
googleCDNZipOut: path.join( "<%= dirs.cdn.google %>","<%= files.zipFileName %>" )
};

// Add minified property to files.css.*
Expand Down Expand Up @@ -495,7 +496,15 @@ module.exports = function( grunt ) {
}
]
},
noversion: {
"jqueryCDN": {
files: {
// WARNING: This will be modified by the config:copy:noversion task
cwd: dist,
src: "<%= files.cdn %>",
dest: "<%= dirs.cdn.jquery %>"
}
},
"googleCDN": {
options: {
processContent: function( content, srcPath ) {
if ( /\.min.js$|\.min.map$/.test( srcPath ) ) {
Expand Down Expand Up @@ -535,7 +544,7 @@ module.exports = function( grunt ) {
},

"hash-manifest": {
noversion: {
googleCDN: {
options: {
algo: "md5",
cwd: "<%= dirs.tmp %>"
Expand All @@ -558,9 +567,9 @@ module.exports = function( grunt ) {
}
]
},
"cdn-noversion": {
"googleCDN": {
options: {
archive: "<%= files.cdnNoversionZipOut %>"
archive: "<%= files.googleCDNZipOut %>"
},
files: [
{
Expand Down Expand Up @@ -720,7 +729,8 @@ module.exports = function( grunt ) {
dist: [ dist ],
git: [ path.join( dist, "git" ) ],
tmp: [ "<%= dirs.tmp %>" ],
"cdn-noversion": [ "<%= dirs.cdn.noversion %>" ]
"googleCDN": [ "<%= dirs.cdn.google %>" ],
"jqueryCDN": [ "<%= dirs.cdn.jquery %>" ]
}
});

Expand Down Expand Up @@ -752,19 +762,46 @@ module.exports = function( grunt ) {
grunt.registerTask( "css", [ "cssbuild" ] );
grunt.registerTask( "css:release", [ "css", "cssmin" ] );

grunt.registerTask( "demos", [ "concat:demos", "copy:demos.nested-includes", "copy:demos.processed", "copy:demos.unprocessed", "copy:demos.backbone" ] );

grunt.registerTask( "cdn", [ "release:init", "clean:tmp", "config:copy:noversion", "copy:noversion", "hash-manifest:noversion", "compress:cdn-noversion", "clean:tmp" ] );

grunt.registerTask( "dist", [ "config:fetchHeadHash", "js:release", "css:release", "copy:images", "demos", "compress:dist" ] );
grunt.registerTask( "demos", [
"concat:demos",
"copy:demos.nested-includes",
"copy:demos.processed",
"copy:demos.unprocessed",
"copy:demos.backbone"
]);

grunt.registerTask( "cdn", [
"release:init",
"clean:jqueryCDN", "config:copy:jqueryCDN", "copy:jqueryCDN",
"clean:tmp",
"config:copy:googleCDN", "copy:googleCDN", "hash-manifest:googleCDN", "compress:googleCDN",
"clean:tmp"
]);

grunt.registerTask( "dist", [
"config:fetchHeadHash",
"js:release",
"css:release",
"copy:images",
"demos",
"compress:dist"
]);
grunt.registerTask( "dist:release", [ "release:init", "dist", "cdn" ] );
grunt.registerTask( "dist:git", [ "dist", "clean:git", "config:copy:git:-git", "copy:git" ] );

grunt.registerTask( "test", [ "jshint", "config:fetchHeadHash", "js:release", "connect", "qunit:http" ] );
grunt.registerTask( "test:ci", [ "qunit_junit", "connect", "qunit:http" ] );

grunt.registerTask( "deploy", [ "release:init", "release:fail-if-pre", "dist:release" ] ); // TODO: Add copy to cdn repo and add / commit / push
grunt.registerTask( "release", [ "clean:dist", "release:init", "release:check-git-status", "release:set-version", "release:tag", "recurse:deploy", "release:set-next-version" ] );
grunt.registerTask( "deploy", [ "release:init", "release:fail-if-pre", "dist:release" ] );
grunt.registerTask( "release", [
"clean:dist",
"release:init",
"release:check-git-status",
"release:set-version",
"release:tag",
"recurse:deploy",
"release:set-next-version"
]);

// Default grunt
grunt.registerTask( "default", [ "dist" ] );
Expand Down
74 changes: 74 additions & 0 deletions build/release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
var scp = require( "scp" ),
path = require( "path" ),
shell = require( "shelljs" );

module.exports = function( Release ) {
Release.define({
issueTracker: "github",
changelogShell: function() {
return "# Changelog for jQuery Mobile v" + Release.newVersion + "\n";
},

generateArtifacts: function( done ) {
Release.exec(
"grunt dist:release"
);
done([]);
},

_uploadZipToWebsite: function( done ) {
var releaseDist = path.join( Release.dir.repo, "dist" ),
zipFilename = "jquery.mobile-" + Release.newVersion + ".zip";

console.log( "Uploading " + zipFilename + " to jquerymobile.com..." );
scp.send({
user: "jqadmin",
host: "jquerymobile.com",
file: path.join( releaseDist, zipFilename),
path: "/var/www/jquerymobile.com/htdocs/resources/download/"
}, function( err ) {
if ( err ) {
Release.abort( "Error while uploading " + zipFilename + " to the website: " + err );
}
done();
});
},

_uploadDemosToWebsite: function( done ) {
var releaseDist = path.join( Release.dir.repo, "dist" ),
zipFilename = "jquery.mobile-" + Release.newVersion + ".zip",
dest = "/var/www/jquerymobile.com/htdocs/demos/" + Release.newVersion;

console.log( "Uploading demos to jquerymobile.com..." );

shell.exec( "ssh jqadmin@jquerymobile.com rm -rf '" + dest + "'" );
shell.exec( "ssh jqadmin@jquerymobile.com mkdir -p '" + dest + "'" );
scp.send({
user: "jqadmin",
host: "jquerymobile.com",
file: path.join( releaseDist, "demos" ) + path.sep + "*",
path: dest
}, function( err ) {
if ( err ) {
Release.abort( "Error while uploading demos to the website: " + err );
}
done();
});

},

_complete: function( done ) {
Release._walk([
Release._uploadZipToWebsite,
Release._uploadDemosToWebsite
], done );
},

complete: function( done ) {
Release._complete(function() {
console.log( "Release of " + Release.project + " version " + Release.newVersion + " complete." );
done();
});
}
});
};
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"devDependencies": {
"async": "0.2.9",
"jsdom": "0.8.3",
"grunt": "0.4.1",
"grunt-contrib-clean": "0.5.0",
"grunt-contrib-compress": "0.5.2",
Expand All @@ -37,11 +38,11 @@
"grunt-contrib-uglify": "0.2.2",
"grunt-git-authors": "1.2.0",
"grunt-qunit-junit": "0.1.0-alpha2",
"requirejs": "2.1.8",
"grunt-hash-manifest": "0.4.0",
"jsdom": "0.8.3",
"xmlhttprequest": "1.6.0",
"optimist": "0.6.0"
"optimist": "0.6.0",
"requirejs": "2.1.8",
"scp": "0.0.3",
"xmlhttprequest": "1.6.0"
},
"main": "Gruntfile.js",
"engines": {
Expand Down

0 comments on commit d65396b

Please sign in to comment.