diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml new file mode 100644 index 000000000..b4123713b --- /dev/null +++ b/.github/workflows/book.yml @@ -0,0 +1,34 @@ +name: Build and deploy 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: Deploy + run: | + git config user.name github-actions + git config user.email github-actions@github.com + make deploy \ No newline at end of file diff --git a/book/Makefile b/book/Makefile index 07432de60..dd2a6c117 100644 --- a/book/Makefile +++ b/book/Makefile @@ -3,7 +3,11 @@ init: poetry install build: - poetry run mkdocs build --strict --clean --verbose + poetry run mkdocs build --strict --clean --verbose --site-dir public + +deploy: build + git submodule update --init --force + cd public && git add . && git commit -m "Deploy book" && git push serve: mkdocs serve \ No newline at end of file