Skip to content

Commit 927e34b

Browse files
committed
ci: add book.yml
1 parent 2d640ca commit 927e34b

File tree

5 files changed

+49
-3
lines changed

5 files changed

+49
-3
lines changed

.github/workflows/book.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build and deploy unstable book
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- "book/**.md"
9+
- "book/mkdocs.yml"
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
name: Build and deploy
15+
runs-on: ubuntu-latest
16+
defaults:
17+
run:
18+
working-directory: book/
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
with:
23+
ssh-key: ${{ secrets.BOOK_DEPLOY_KEY }}
24+
- name: Set up Python Virtualenv
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: 3.9
28+
- name: Install dependencies
29+
run: make init
30+
- name: Configure git
31+
run: git config --global user.email "github-actions@github.com" && git config --global user.name "github-actions"
32+
- name: Deploy unstable book
33+
run: make deploy-unstable

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "book/public"]
2+
path = book/public
3+
url = https://github.com/rust-nostr/rust-nostr.github.io.git

book/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

book/Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@ init:
22
pip install -U poetry
33
poetry install
44

5-
build:
6-
poetry run mkdocs build --strict --clean --verbose
5+
checkout:
6+
git submodule update --init --recursive --remote
7+
8+
build: checkout
9+
poetry run mkdocs build --strict --clean --verbose --site-dir public/book
10+
11+
deploy: build
12+
cd public && git add book && git commit -m "Deploy book" && git push origin HEAD:master --force
13+
14+
deploy-unstable: checkout
15+
poetry run mkdocs build --strict --clean --verbose --site-dir public/book-unstable
16+
cd public && git add book-unstable && git commit -m "Deploy unstable book" && git push origin HEAD:master --force
717

818
serve:
919
mkdocs serve

book/public

Submodule public added at 9de3ac8

0 commit comments

Comments
 (0)