This action builds and publishes a gitbook to github pages and other pages. Click here for more information.
GitHub MarketPlace Page Community
Add .github/workflows/gitbook-action.yml
in your repo, with following content.
name: 'Gitbook Action Build'
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout action
uses: actions/checkout@v2
- name: Gitbook Action
uses: meese-enterprises/gitbook-action@master
with:
token: $
Detailed step | Official introduction |
Create token from https://github.com/settings/tokens
Detailed step | Official introduction |
Add your token to https://github.com/yourname/yourrepo/settings/secrets
Detail step | Official introduction |
master
, and the target branch is gh-pages
. If gh-pages
does not exist, it will be created automatically.git_name:
description: ‘If git name is different with GitHub, please add’
default: **@users.noreply.github.com
time_zone:
source_token:
source_git_name:
description: ‘default is github.com,can be gitlib.com gitee.com …’
default: ‘github.com’
source_branch:
description: ‘Default master’
default: ‘master’
source_dir:
description: ‘Where gitbook source. Default is root, if not add like mydir, instead of /mydir or mydir/’
default: ‘/’
source_edit_time:
description: ‘Default false, if plugins need last edit time, set true’
default: false
source_file_without_prefix:
description: ‘Default true, if you want to ignore file without prefix please set false’
default: true
publish_token:
publish_git_name:
publish_git_email:
publish_commit_message:
github.event.head_commit.message
as last commit message example1description: ‘Default is github.com,can be gitlib.com gitee.com …’
default: ‘github.com’
publish_branch:
description: ‘Defaule is gh-pages, auto create’
default: ‘gh-pages’
publish_dir:
description: ‘Default is root, if not add like docs …’
default: ‘/’
publish_commit_history:
description: ‘set false will only one commit at publish_repo’
default: true
publish_cname:
description: ‘Default null’
default: ‘null’
publish_nojekyll:
description: ‘Default false, if set true, it will add .nojekyll for publish’
default: ‘false’
publish_push_force:
description: ‘Default false. Set true will enable git push force’
default: false
publish_remove_last_build:
description: ‘Default true. Set false not remove last build but rewrite same file’
default: true
gitbook_cli_version:
description: ‘Default is 2.3.2’
default: ‘2.3.2’
gitbook_version:
description: ‘Default is 3.2.3’
default: ‘3.2.3’
gitbook_pdf:
description: ‘Set true will generate pdf file’
default: false
gitbook_pdf_dir:
description: ‘Where the pdf to put. Default mybook, can change / for root, or myebook’
default: ‘mybook’
gitbook_pdf_name:
description: ‘The name of your pdf. Default ebook’
default: ‘ebook’
gitbook_epub:
description: ‘Set true will generate epub file’
default: false
gitbook_epub_dir:
description: ‘’
default: ‘mybook’
gitbook_epub_name:
description: ‘’
default: ‘ebook’
gitbook_mobi:
description: ‘Set true will generate mobi file’
default: false
gitbook_mobi_dir:
description: ‘’
default: ‘mybook’
gitbook_mobi_name:
sudo apt-get install fonts-noto-cjk
orsudo apt-get install ttf-mscorefonts-installer
,use sudo install for global.npm i --unsafe-perm -g svgexport@0.3.2
,install specific svgexport version for converting svg.source2_git_name:
source2_token:
source2_hub:
description: ‘’
default: ‘github.com’
source2_branch:
description: ‘’
default: ‘master’
source2_dir:
description: ‘’
default: ‘/’
source2_edit_time:
description: ‘Default false if plugins need last edit time, set true’
default: false
source2_file_without_prefix:
description: ‘Default true, if you want to ignore file without prefix please set false’
default: true
publish2_git_name:
publish2_token:
publish2_git_email:
publish2_commit_message:
publish2_hub:
description: ‘’
default: ‘github.com’
publish2_branch:
description: ‘Default gh-pages’
default: ‘gh-pages’
publish2_dir:
description: ‘’
default: ‘/’
publish2_cname:
description: ‘Default null’
default: ‘null’
publish2_push_force:
description: ‘Default false. Set true will enable git push force’
default: false
publish_remove_last_build:
description: ‘Default true. Set false not remove last build but rewrite same file’
default: true
publish2_commit_history:
description: ‘set false will only one commit at publish2_repo’
default: true
publish2_nojekyll:
description: ‘Default false, if set true, it will add .nojekyll for publish2’
default: ‘false’
publish3_git_name:
publish3_token:
publish3_git_email:
publish3_commit_message:
publish3_hub:
description: ‘’
default: ‘github.com’
publish3_repo:
description: ‘Default null, if use please add like username/reponame’
default: ‘null’
publish3_branch:
description: ‘Default gh-pages’
default: ‘gh-pages’
publish3_dir:
description: ‘Default root’
default: ‘/’
publish3_cname:
description: ‘Default null’
default: ‘null’
publish3_push_force:
description: ‘Default false. Set true will enable git push force’
default: false
publish_remove_last_build:
description: ‘Default true. Set false not remove last build but rewrite same file’
default: true
publish3_commit_history:
publish3_nojekyll:
description: ‘Default false, if set true, it will add .nojekyll for publish3’
default: ‘false’
name: "Gitbook-Action"
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout action
uses: actions/checkout@v1
# example1--> https://ZanderZhao.github.io/gitbook-action
- name: Gitbook Action
uses: meese-enterprises/gitbook-action@master
with:
token: $
time_zone: Asia/Shanghai # set time zone
source_dir: source # clone from source
source_edit_time: true # source time
publish_commit_message: $ # use last commit message
# example2--> https://ZanderZhao.github.io/gitbook-action/gitbook-docs
- name: Gitbook Action
uses: meese-enterprises/gitbook-action@master
with:
token: $
time_zone: Asia/Shanghai
source_repo: GitbookIO/gitbook # clone from https://github.com/GitbookIO/gitbook.git
source_branch: master # clone source master
source_dir: docs # gitbook-sorce at dir:docs
publish_dir: gitbook-docs # publish for this repo dir:gitbook-docs
publish2_repo: gitbook-org/gitbook # publish for another repo dir default root
source_edit_time: true
publish_cname: www.example.com
publish_cname: example.com www.example.com
example.com
and www.example.com
should have space.About PDF/EPUB/MOBI
gitbook_pdf: true
gitbook_pdf_dir
and gitbook_pdf_name
font_install
font_install: sudo apt-get install fonts-noto-cjk
orfont_install: sudo apt-get install ttf-mscorefonts-installer
,use sudo install for global.About source_repo
source_repo is the repo where gitbook-source(SUMMARY.md README.md) deposit
you can set source_repo
、 source_branch
andsource_dir
source_repo: GitbookIO/gitbook
source_branch: master
source_dir: docs
publish_repo
、publish_branch
andpublish_dir
publish_dir