Deploy
Here is a simple bash script that can deploy to gh-pages.
Download
./scripts/download_bbook.sh
1#!/bin/bash
2
3mkdir -p bin
4
5if [ ! -f bin/bbook ]
6then
7 echo "downloading banana-book"
8 curl -sSL https://github.com/dfirebaugh/bbook/releases/download/v0.0.0/bbook-x86_64_unknown-linux.tar.gz | tar -xz --directory=bin
9else
10 echo "bin/bbook already exists"
11fi
Build
./scripts/build_docs.sh
1#!/bin/bash
2
3source ./scripts/download_bbook.sh
4
5mkdir -p .dist/web/
6
7cd docs/user_docs
8../../bin/bbook build
9cp -r .book/* ../../.dist/web/
10cd ../../
Deploy
./scripts/deploy_docs.sh
1#!/bin/bash
2
3source ./scripts/build_docs.sh
4
5GIT_REPO_URL=$(git config --get remote.origin.url)
6
7cd .book
8git init .
9git remote add github $GIT_REPO_URL
10git checkout -b gh-pages
11git add .
12git commit -am "Static site deploy"
13git push github gh-pages --force
14cd ..
Github Action
1name: Deploy to GitHub Pages
2
3on:
4 push:
5 branches:
6 - main
7
8jobs:
9 deploy:
10 runs-on: ubuntu-latest
11
12 steps:
13 - name: Checkout
14 uses: actions/checkout@v3
15
16 - name: Set up Go
17 uses: actions/setup-go@v4
18 with:
19 go-version: '^1.19.x'
20
21 - name: Run bbook
22 run: |
23 cd docs
24 bbook build
25
26 - name: Deploy
27 uses: peaceiris/actions-gh-pages@v3
28 with:
29 github_token: ${{ secrets.GITHUB_TOKEN }}
30 publish_dir: ./docs/.book