GitHub Actions for Leanpub.com
Project description
Leanpub Multi Action
A GitHub Action to interact with the Leanpub API. Preview, publish, and check job status for your Leanpub books — directly from your GitHub workflows.
Quick Start
- name: "Preview Book"
uses: "lykinsbd/leanpub-multi-action@v2"
with:
leanpub-api-key: "${{ secrets.LEANPUB_API_KEY }}"
leanpub-book-slug: "mygreatbook"
action: "preview"
Inputs
| Name | Required | Default | Description |
|---|---|---|---|
leanpub-api-key |
Yes | — | Leanpub API key (requires a Pro plan). Store as a GitHub Secret. |
leanpub-book-slug |
Yes | — | Book slug — the path component after https://leanpub.com/. |
action |
Yes | — | Action to perform: preview, publish, unpublish, check-status, book-summary, or book-exists. |
email-readers |
No | "false" |
Email readers about a new publish. Only used with publish. |
release-notes |
No | — | Release notes for the publish. Only used with publish. |
subset |
No | "false" |
Preview only the files listed in Subset.txt. Only used with preview. |
single-file |
No | — | Path to a Markdown file for single-file preview. Only used with preview. |
wait |
No | "false" |
Poll until job completes. Only used with check-status. |
poll-interval |
No | "5" |
Seconds between polls. Only used with check-status --wait. |
timeout |
No | "120" |
Max seconds to wait. Only used with check-status --wait. |
Examples
Full preview on push
---
name: "Preview on Push"
"on":
push:
branches: ["preview"]
jobs:
preview:
runs-on: "ubuntu-latest"
steps:
- name: "Preview Book"
uses: "lykinsbd/leanpub-multi-action@v2"
with:
leanpub-api-key: "${{ secrets.LEANPUB_API_KEY }}"
leanpub-book-slug: "mygreatbook"
action: "preview"
Subset preview
Preview only the files listed in your book's Subset.txt:
- name: "Subset Preview"
uses: "lykinsbd/leanpub-multi-action@v2"
with:
leanpub-api-key: "${{ secrets.LEANPUB_API_KEY }}"
leanpub-book-slug: "mygreatbook"
action: "preview"
subset: "true"
Single-file preview
Preview a single Markdown file without modifying Subset.txt.
The output PDF is saved as {slug}-single-file.pdf in your Dropbox previews folder.
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Single File Preview"
uses: "lykinsbd/leanpub-multi-action@v2"
with:
leanpub-api-key: "${{ secrets.LEANPUB_API_KEY }}"
leanpub-book-slug: "mygreatbook"
action: "preview"
single-file: "manuscript/chapter-05.md"
Publish with release notes
- name: "Publish"
uses: "lykinsbd/leanpub-multi-action@v2"
with:
leanpub-api-key: "${{ secrets.LEANPUB_API_KEY }}"
leanpub-book-slug: "mygreatbook"
action: "publish"
email-readers: "true"
release-notes: "Chapter 5 added"
Unpublish
- name: "Unpublish"
uses: "lykinsbd/leanpub-multi-action@v2"
with:
leanpub-api-key: "${{ secrets.LEANPUB_API_KEY }}"
leanpub-book-slug: "mygreatbook"
action: "unpublish"
Check job status
- name: "Check Status"
uses: "lykinsbd/leanpub-multi-action@v2"
with:
leanpub-api-key: "${{ secrets.LEANPUB_API_KEY }}"
leanpub-book-slug: "mygreatbook"
action: "check-status"
Poll until job completes
- name: "Wait for Preview"
uses: "lykinsbd/leanpub-multi-action@v2"
with:
leanpub-api-key: "${{ secrets.LEANPUB_API_KEY }}"
leanpub-book-slug: "mygreatbook"
action: "check-status"
wait: "true"
poll-interval: "10"
timeout: "300"
Get book summary
Retrieve book metadata including download URLs, word count, and sales info:
- name: "Book Summary"
uses: "lykinsbd/leanpub-multi-action@v2"
with:
leanpub-api-key: "${{ secrets.LEANPUB_API_KEY }}"
leanpub-book-slug: "mygreatbook"
action: "book-summary"
Check if book exists
- name: "Book Exists"
uses: "lykinsbd/leanpub-multi-action@v2"
with:
leanpub-api-key: "${{ secrets.LEANPUB_API_KEY }}"
leanpub-book-slug: "mygreatbook"
action: "book-exists"
CLI Usage
The action also ships as a standalone CLI tool called lma.
uv tool install leanpub-multi-action
or with pip:
pip install leanpub-multi-action
lma --leanpub-api-key YOUR_KEY --book-slug mygreatbook preview
lma --leanpub-api-key YOUR_KEY --book-slug mygreatbook preview --subset
lma --leanpub-api-key YOUR_KEY --book-slug mygreatbook preview --single-file chapter.md
lma --leanpub-api-key YOUR_KEY --book-slug mygreatbook publish --email-readers --release-notes "v2"
lma --leanpub-api-key YOUR_KEY --book-slug mygreatbook unpublish
lma --leanpub-api-key YOUR_KEY --book-slug mygreatbook check-status
lma --leanpub-api-key YOUR_KEY --book-slug mygreatbook check-status --wait --timeout 300
lma --leanpub-api-key YOUR_KEY --book-slug mygreatbook book-summary
lma --leanpub-api-key YOUR_KEY --book-slug mygreatbook book-exists
Contributing
See CONTRIBUTING.md for development setup and guidelines.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file leanpub_multi_action-2.1.0.tar.gz.
File metadata
- Download URL: leanpub_multi_action-2.1.0.tar.gz
- Upload date:
- Size: 44.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cf056dff314f973c00a30b22b249234b77864bd394a7d8f0aa950f1c07cbd81
|
|
| MD5 |
f052669a8562b4797dd6fcd5cfd35964
|
|
| BLAKE2b-256 |
6ad8ff34a8464bfa6d17ae1dc67141f6778de9bb91e87eae5b8e16bc1c7ae5e3
|
File details
Details for the file leanpub_multi_action-2.1.0-py3-none-any.whl.
File metadata
- Download URL: leanpub_multi_action-2.1.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72c04d16fcb2f9999d291db1bf320da8ee61199b15cf0de33c819b67e6506674
|
|
| MD5 |
e95af20f69c51041b8bedc457a784a00
|
|
| BLAKE2b-256 |
6e32eea667762813ba4c339c3a84364cadccd1fd437f50e0e00a119dd4c437fd
|