61 lines
1.6 KiB
YAML
61 lines
1.6 KiB
YAML
name: book
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
paths:
|
|
- 'book/**'
|
|
- 'book.toml'
|
|
pull_request:
|
|
branches: [master]
|
|
paths:
|
|
- 'book/**'
|
|
- 'book.toml'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install mdbook
|
|
run: |
|
|
mkdir mdbook
|
|
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.21/mdbook-v0.4.21-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
|
|
echo `pwd`/mdbook >> $GITHUB_PATH
|
|
|
|
- name: Install mdbook-template
|
|
run: |
|
|
mkdir mdbook-template
|
|
curl -sSL https://github.com/sgoudham/mdbook-template/releases/latest/download/mdbook-template-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook-template
|
|
echo `pwd`/mdbook-template >> $GITHUB_PATH
|
|
|
|
- name: Build
|
|
run: mdbook build
|
|
|
|
- name: Save pages artifact
|
|
uses: actions/upload-pages-artifact@v1
|
|
with:
|
|
path: target/book
|
|
|
|
deploy:
|
|
# Only deploy if a push to master
|
|
if: github.ref_name == 'master' && github.event_name == 'push'
|
|
runs-on: ubuntu-latest
|
|
needs: [build]
|
|
|
|
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
|
|
permissions:
|
|
pages: write
|
|
id-token: write
|
|
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
|
|
steps:
|
|
# reference: https://github.com/actions/deploy-pages
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v1 |