Created
January 27, 2018 23:05
-
-
Save jeffreysbrother/9908979734d59805c85771f75fa69ab2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var plan = require('flightplan'); | |
var username = 'logicfo3'; | |
plan.target('production', [ | |
{ | |
host: '69.195.124.76', | |
username: username, | |
privateKey: '/Users/jc/.ssh/id_rsa', | |
agent: process.env.SSH_AUTH_SOCK | |
}, | |
]); | |
plan.local(function(local) { | |
// prompt for passphrase (so we don't have to hardcode it in the object above) | |
var passphrase = local.prompt('Enter your passphrase:', { hidden: true }); | |
plan.target().runtime.hosts.forEach(function(host) { | |
host.passphrase = passphrase; | |
}); | |
// build jekyll for production | |
local.exec('JEKYLL_ENV=production jekyll build', {silent: true}); | |
local.log('Copying files to remote host'); | |
// copy only the _site directory to ~ of server | |
var filesToCopy = local.find('\_site -type f', {silent: true}); | |
local.transfer(filesToCopy, '~'); | |
}); | |
plan.remote(function(remote) { | |
// move the contents of the copied folder to public_html/ | |
remote.exec('cp -R ~/_site/* ~/public_html', {user: username}); | |
// remove the temporary _site folder from the server | |
remote.exec('rm -rf ~/_site'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment