Deploying Jekyll on shared hosting

Recently I have been wanting to have the following:

After some Googling, this doesn’t appear like a very common thing to do. Maybe it’s that most people who would use Jekyll stay far, far away from shared hosting. From my experience this seems like a very sensible thing to do. Unfortunately I’m stuck with it for now.

Anyway, I hacked together a solution recently and felt like sharing.

If this might be useful for you, feel free to use one or both of these:

NB: I have only tested this on one shared hosting provider (Namecheap). This might break your stuff. If that happens I will not accept any responsibility. Notably, the current behaviour for upload-site is to delete everything in the public_html directory before copying the new content over, so please be aware of that.