Skip to content

Commit

Permalink
Create action.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ZanderZhao authored Jan 4, 2020
1 parent 47c4931 commit 1df9e45
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions action.yml
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

0 comments on commit 1df9e45

Please sign in to comment.