Skip to content

Instantly share code, notes, and snippets.

@drewlustro
Last active Aug 29, 2015
Embed
What would you like to do?
Simple gulp-rsync deploy
server {
listen 80;
root /sites/SOME-SITE-ROOT-DIRECTORY/staging0;
index index.html index.htm;
server_name staging0.jessechorng.com;
location / {
try_files $uri $uri/ /index.html /index.htm;
}
location ~* .(jpg|jpeg|png|gif|ico|css|js|svg)$ {
expires 1m;
}
}
var argv = require('yargs')
.options('d', {
alias: 'dest',
default: 'staging0'
})
.usage('Usage: $0 -d <staging[0-3]|live>')
.argv;
gulp.task('deploy', ['build'], function() {
var dest = '/sites/SOME-SITE-ROOT-DIRECTOY/' + argv.d;
console.log('Deploy Destination: "' + dest + '"');
return gulp.src('dist/**')
.pipe($.rsync({
root: 'dist',
hostname: 'user@maxrelax.co',
destination: dest,
user: 'user',
incremental: true,
progress: true,
compress: true,
recursive: true
}));
});
@drewlustro
Copy link
Author

drewlustro commented Dec 13, 2014

Deploy to staging0
gulp deploy

Deploy to target (such as live)
gulp deploy -d live

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment