Skip to content

Instantly share code, notes, and snippets.

@aaroneaton
Last active August 29, 2015 14:16
Show Gist options
  • Save aaroneaton/385d94015e66b3266898 to your computer and use it in GitHub Desktop.
Save aaroneaton/385d94015e66b3266898 to your computer and use it in GitHub Desktop.
Full gruntfile
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
mkdir: {
all: {
options: {
create: ['dist']
}
}
},
compress: {
main: {
options: {
archive: 'my-cool-plugin.zip'
},
expand: true,
src: [
'assets/*',
'includes/*',
'my-cool-plugin.php'
],
dest: 'my-cool-plugin/'
}
},
rename: {
main: {
files: [
{src: ['my-cool-plugin.zip'], dest: 'dist/my-cool-plugin.zip'}
]
}
},
aws_s3: {
options: {
accessKeyId: '1234', // Use your own access key
secretAccessKey: 'abcd', // Use your own secret access key
region: 'US1', // Fill in your S3 region
uploadConcurrency: 5, // 5 simultaneous uploads
downloadConcurrency: 5, // 5 simultaneous downloads
params: {
CacheControl: '2592000'
}
},
myBucket: {
options: {
bucket: 'my-bucket' // Change this to your S3 bucket name
},
files: [
{
dest: 'plugins/my-cool-plugin.zip',
action: 'delete' // Let's delete the old version
},
{
src: 'dist/my-cool-plugin.zip', // The file to upload
dest: 'plugins', // destination folder on S3
expand: true,
flatten: true
}
]
}
}
});
grunt.registerTask('default', 'An empty task', function() {
grunt.log.error('This is an empty task to keep bad things from happening.');
return false;
});
grunt.registerTask('package', ['mkdir', 'compress', 'rename', 'aws_s3:myBucket']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment