Leanpub lets you use webhooks to trigger a preview or a publish event whenever you push to your GitHub repository, if you're writing your book using our GitHub writing mode.
First, go to the Webhooks page for your book here:
...making sure to replace YOUR_BOOK with your book's unique web address.
You can also navigate to this page from your book's Overview page:
On that page, you'll find the Payload URLs you will need to copy into GitHub:
The top Payload URL is the one you will use if you want to trigger a preview every time you push to your repository; the bottom Payload URL is the on you will use if you want to publish a new version of your book every time you push to your repository.
NOTE: Do NOT show your API key to anyone! Treat it like a password.
(In the example above, we've blurred out the actual API key - do not show your API key to anyone!)
Select the URL you want to use and copy it.
Next, on GitHub, go to the repository for your book and click on "Settings":
Next, select "Webhooks":
This will take you to the Webhooks page for your repository. Now, click on "Add webhook":
(At this point, you may be prompted to enter your GitHub password.)
Paste the Payload URL you copied earlier into the "Payload URL" box:
(We've blurred out the actual API key again in this example.)
Next, click the "Add webhook" button:
You will now see that the webhook has been added to your repository:
That's it! The next time you push to your repository, that will trigger a preview of your book, or publish a new version of your book, depending on which option you chose. Please note that it may take a moment or two before you see the progress bar, indicating that the book generation process is under way.