Skip to content

Instantly share code, notes, and snippets.

@drewlustro
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewlustro/b40c6af3f5506a47dbc7 to your computer and use it in GitHub Desktop.
Save drewlustro/b40c6af3f5506a47dbc7 to your computer and use it in GitHub Desktop.
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

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