Note: This tool is no longer maintained. There are a number of newer and better approaches to update jekyll-powered websites. We use Continious Integration (e.g. Travis) as a replacement for jekyll-hook at Development Seed. Read more here: https://jekyllrb.com/docs/deployment-methods/
A server that listens for webhook posts from GitHub, generates a website with
Jekyll, and moves it somewhere to be published. Use this to run your own GitHub
Pages-style web server. Great for when you need to serve your websites behind a
firewall, need extra server-level features like HTTP basic auth (see below for an
NGINX config with basic auth), or want to host your site directly on a CDN or
file host like S3. It's cutomizable with two user-configurable shell scripts
and a config file.
host SMTP host for sending email account (e.g. smtp.gmail.com)
ssltrue or false for SSL
accounts An array of accounts or organizations whose repositories can be used
with this server
You can also adjust build.sh and publish.sh to suit your workflow. By default,
they generate a site with Jekyll and publish it to an NGINX web directory.
Webhook Setup on Github
Set a Web hook on your GitHub repository
that points to your jekyll-hook server http://example.com:8080/hooks/jekyll/:branch, where :branch is the branch you want to publish. Usually this is gh-pages or master for *.github.com / *.github.io repositories.
For every branch you want to build/publish (as defined in the scripts) you need to set up a different webhook.
Configure a webserver (nginx)
The default publish.sh is setup for nginx and copies _site folder to /usr/share/nginx/html/rep_name.
If you would like to copy the website to another location, make sure to update
nginx virtual hosts which is located at /etc/nginx/nginx/site-available on Ubuntu 14.
scripts/publish-s3.sh does the rest of the job for you. Just make sure to add your bucket name there.
More details on build.sh
The stock build.sh copies rendered site files to subdirectories under a web server's www root directory. For instance, use this script and NGINX with the following configuration file to serve static content behind HTTP basic authentication:
server {
root /usr/share/nginx/www;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
# Optional basic auth restriction
# auth_basic "Restricted";
# auth_basic_user_file /etc/nginx/.htpasswd;
}
}
Replace this script with whatever you need for your particular hosting environment.
You probably want to configure your server to only respond POST requests from GitHub's
public IP addresses, found on the webhooks settings page.
请发表评论