Skip to content

Commit

Permalink
ci: add book.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
yukibtc committed Sep 30, 2023
1 parent 2d640ca commit 927e34b
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 3 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build and deploy unstable book

on:
push:
branches:
- master
paths:
- "book/**.md"
- "book/mkdocs.yml"
workflow_dispatch:

jobs:
build:
name: Build and deploy
runs-on: ubuntu-latest
defaults:
run:
working-directory: book/
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.BOOK_DEPLOY_KEY }}
- name: Set up Python Virtualenv
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: make init
- name: Configure git
run: git config --global user.email "[email protected]" && git config --global user.name "github-actions"
- name: Deploy unstable book
run: make deploy-unstable
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "book/public"]
path = book/public
url = https://github.com/rust-nostr/rust-nostr.github.io.git
1 change: 0 additions & 1 deletion book/.gitignore

This file was deleted.

14 changes: 12 additions & 2 deletions book/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@ init:
pip install -U poetry
poetry install

build:
poetry run mkdocs build --strict --clean --verbose
checkout:
git submodule update --init --recursive --remote

build: checkout
poetry run mkdocs build --strict --clean --verbose --site-dir public/book

deploy: build
cd public && git add book && git commit -m "Deploy book" && git push origin HEAD:master --force

deploy-unstable: checkout
poetry run mkdocs build --strict --clean --verbose --site-dir public/book-unstable
cd public && git add book-unstable && git commit -m "Deploy unstable book" && git push origin HEAD:master --force

serve:
mkdocs serve
1 change: 1 addition & 0 deletions book/public
Submodule public added at 9de3ac

0 comments on commit 927e34b

Please sign in to comment.