ci: build/deploy book

This commit is contained in:
Georgios Konstantopoulos 2023-01-04 13:26:25 +02:00 committed by GitHub
parent 9957e0dec9
commit 71fbf8c6b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 61 additions and 0 deletions

61
.github/workflows/book.yml vendored Normal file
View File

@ -0,0 +1,61 @@
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