Przeglądaj źródła

release script and grunt-bump

Adam Shaw 11 lat temu
rodzic
commit
a068358153
2 zmienionych plików z 39 dodań i 7 usunięć
  1. 19 7
      Gruntfile.js
  2. 20 0
      build/release.sh

+ 19 - 7
Gruntfile.js

@@ -13,11 +13,8 @@ module.exports = function(grunt) {
 	grunt.loadNpmTasks('grunt-contrib-jshint');
 	grunt.loadNpmTasks('grunt-jscs-checker');
 	grunt.loadNpmTasks('grunt-karma');
+	grunt.loadNpmTasks('grunt-bump');
 	grunt.loadNpmTasks('lumbar');
-
-	// Parse config files
-	var packageConfig = grunt.file.readJSON('package.json');
-	var pluginConfig = grunt.file.readJSON('fullcalendar.jquery.json');
 	
 	// This will eventually get passed to grunt.initConfig()
 	// Initialize multitasks...
@@ -31,8 +28,8 @@ module.exports = function(grunt) {
 		}
 	};
 
-	// Combine certain configs for the "meta" template variable (<%= meta.whatever %>)
-	config.meta = _.extend({}, packageConfig, pluginConfig);
+	// for the "meta" template variable (<%= meta.whatever %>)
+	config.meta = grunt.file.readJSON('fullcalendar.jquery.json');
 
 	// The "grunt" command with no arguments
 	grunt.registerTask('default', 'archive');
@@ -276,6 +273,20 @@ module.exports = function(grunt) {
 
 
 
+	/* Release Utilities
+	----------------------------------------------------------------------------------------------------*/
+
+	config.bump = { // changes the version number in the configs
+		options: {
+			files: '*.json',
+			commit: false,
+			createTag: false,
+			push: false
+		}
+	};
+
+
+
 	/* CDNJS (http://cdnjs.com/)
 	----------------------------------------------------------------------------------------------------*/
 
@@ -310,11 +321,12 @@ module.exports = function(grunt) {
 	};
 
 	grunt.registerTask('cdnjsConfig', function() {
+		var jqueryConfig = grunt.file.readJSON('fullcalendar.jquery.json');
 		var cdnjsConfig = grunt.file.readJSON('build/cdnjs.json');
 		grunt.file.write(
 			'dist/cdnjs/package.json',
 			JSON.stringify(
-				_.extend({}, pluginConfig, cdnjsConfig), // combine 2 configs
+				_.extend({}, jqueryConfig, cdnjsConfig), // combine 2 configs
 				null, // replace
 				2 // indent
 			)

+ 20 - 0
build/release.sh

@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+cd "`dirname $0`/../"
+
+read -p "Enter the new version number with no 'v' (for example '1.0.1'): " version
+
+if [[ ! "$version" ]]
+then
+	exit;
+fi
+
+grunt bump --setversion=$version && \
+grunt dist && \
+git add *.json && \
+git add -f dist/*.js dist/*.css dist/lang/*.js && \
+git commit -e -m "Release v$version" && \
+git tag -a v$version -m "Release v$version" && \
+echo && \
+echo 'DONE. It is now up to you to run `'"git push origin v$version"'`' && \
+echo