jmak35
jmak35

Reputation: 13

How to automate building and deploying Jekyll site to webserver via FTP

My Jekyll files are stored in Bitbucket, and I would like to be able to automatically generate the _site folder on every new change that gets pushed. (Note, I don't want to push my _site folder to Git, that is out of the question.)

Once this _site is generated, I would then like to automatically deploy it to my webserver via FTP.

Is this at all possible? What are my options?

Upvotes: 1

Views: 1836

Answers (1)

matrixanomaly
matrixanomaly

Reputation: 6947

Since you didn't mention where the _site folder will go, here' a generic answer.

In short, you would need a webserver or a service that listens for a Bitbucket Post Commit Hook. Here is the relevant documentation for that.

That way, on every push, Bitbucket will trigger the action and notify your server/app/service that will then build the new _site and deploy to where you want to.

Here's a good tutorial on setting it up with the use of cron jobs and a webserver. Link.

A simple VPS would also work, or some tiny Amazon EC instance/Azure virtual machine.

Of course, these will likely not be 100% free.

If you hate using servers, a continuous integration (CI) service can be used instead, where on commit the hooks will trigger a build,

Travis-CI and Drone.io are free for public repositories, but if your repository is private you'll have to go for the paid service. There are many others as well.

(Note Travis-CI is not compatible with Bitbucket at the time of writing. It works with GitHub.)

Basically a CI is used to run tests, but aside from that, we can use it to generate a build and push or copy the _site to somewhere, maybe your own server. Or in the case of how this article describes it, another repository. (Read 'Becoming a Jekyll God' on some creative ways on deploying.)

Upvotes: 2

Related Questions