-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
96 lines (73 loc) · 2.67 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/**
* Created by sam on 16-7-25.
*/
var exec= require('child_process').exec;
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-aws-s3');
grunt.loadNpmTasks('grunt-cloudfront');
grunt.config.init({
aws_s3: {
options: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID, // Use the variables
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, // You can also use env variables
uploadConcurrency: 5, // 5 simultaneous uploads
downloadConcurrency: 5 // 5 simultaneous downloads
},
production: {
options: {
region: 'us-west-2',
bucket: 'vectorly.io',
differential: true // Only uploads the files that have changed
},
files: [
{
expand: true,
cwd: 'src',
src: ['**', '!**/*~'],
dest: 'docs'
}
]
},
staging: {
options: {
region: 'us-west-2',
bucket: 'vectorly.io',
differential: true // Only uploads the files that have changed
},
files: [
{
expand: true,
cwd: 'src',
src: ['**', '!**/*~'],
dest: 'docs_staging'
}
]
}
},
cloudfront: {
options: {
region:'us-west-2', // your AWS region
distributionId:"E2XU8J1PRAM207", // DistributionID where files are stored
listInvalidations:true, // if you want to see the status of invalidations
listDistributions:false, // if you want to see your distributions list in the console
version:"1.0" // if you want to invalidate a specific version (file-1.0.js)
},
production: {
CallerReference: Date.now().toString(),
Paths: {
Quantity: 1,
Items: [ '/docs/*' ]
}
},
staging: {
CallerReference: Date.now().toString(),
Paths: {
Quantity: 1,
Items: [ '/docs_staging/*' ]
}
}
},
});
grunt.registerTask('production', ['aws_s3:production', 'cloudfront:production']);
grunt.registerTask('staging', ['aws_s3:staging', 'cloudfront:staging']);
};