-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.js
More file actions
31 lines (27 loc) · 747 Bytes
/
deploy.js
File metadata and controls
31 lines (27 loc) · 747 Bytes
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
#!/usr/bin/env node
// copy from https://github.com/meteor/hexo-s3-deploy/blob/master/index.js
var s3 = require('s3')
var config = {
s3Options: {
accessKeyId: process.env.AWS_BLOG_KEY,
secretAccessKey: process.env.AWS_BLOG_SECRET,
region: 'ap-northeast-1'
}
}
var client = s3.createClient(config)
var uploader = client.uploadDir({
localDir: '/Users/ocowchun/projects/github/blog/public',
s3Params: {
Prefix: '',
Bucket: 'blog.ocowchun.com'
}
})
uploader.on('error', function(err) {
console.error('unable to sync:', err.stack)
})
uploader.on('progress', function() {
console.log('progress', uploader.progressAmount, uploader.progressTotal)
})
uploader.on('end', function() {
console.log('done uploading')
})