-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47c4931
commit 1df9e45
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# You must put this in your repo master branch as repo/.github/workflow/gitbook_action.yml | ||
# You must add the following secrets in your Secrets(repo->Setting->Secrets->Add a new secret) | ||
# Name: GIT_NAME Value: your git name like ZanderZhao | ||
# Name: GIT_EMAIL Value: your git email like [email protected] | ||
# Name: THE_GITHUB_TOKEN Value: you can git it from Settings->Developer settings->Personal access tokens->Generate new token | ||
# Name: THE_GITHUB_REF Value: github.com/your_name/your_repo_name.git | ||
# Name: RES_FOR_PAGES Value: put the branch name here like gh-pages,where the build book you want put for | ||
# Pay attention,THE_GITHUB_REF can't add https:// before, | ||
# And RES_FOR_PAGES must be create and be set as pages before. | ||
# When you make THE_GITHUB_TOKEN ,the push permission is must have,the others, you can add. | ||
# You can visit https://zlogs.net/gitnook-action/ for more information. | ||
|
||
name: 'Gitbook Action' | ||
description: 'Github Action For Gitbook' | ||
author: 'ZanderZhao' | ||
branding: | ||
icon: 'book' | ||
color: 'gray-dark' | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [8] | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: install_gitbook_plugins | ||
run: | | ||
npm install gitbook-cli -g | ||
gitbook -v | ||
gitbook install | ||
- name: build_gitbook | ||
run: | | ||
gitbook build | ||
- name: push_to_pages | ||
run: | | ||
cd ./_book | ||
git init | ||
git config --local user.name "${{ secrets.GIT_NAME }}" | ||
git config --local user.email "${{ secrets.GIT_EMAIL }}" | ||
git add * | ||
git commit -m "update" | ||
git push --force "https://${{ secrets.THE_GITHUB_TOKEN }}@${{ secrets.THE_GITHUB_REF }}" master:${{ secrets.RES_FOR_PAGES }} | ||
env: | ||
CI: true |