Skip to content

Commit

Permalink
Move to mkdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsDrike committed Aug 1, 2024
1 parent 2dadf30 commit 8288c8f
Show file tree
Hide file tree
Showing 29 changed files with 563 additions and 1,679 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
name: MkDocs

on:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write
pull-requests: write

jobs:
deploy-docs:
runs-on: ubuntu-latest
steps:
- name: Generate token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}

- name: Checkout repository
uses: actions/checkout@v4
with:
token: "${{ steps.app-token.outputs.token }}"

# Make the github application be the committer
# (see: https://stackoverflow.com/a/74071223 on how to obtain the committer email)
- name: Setup git config
run: |
git config --global user.name "py-mine-ci-bot"
git config --global user.email "121461646+py-mine-ci-bot[bot]@users.noreply.github.com"
- name: Setup poetry
id: poetry_setup
uses: ItsDrike/setup-poetry@v1
with:
python-version: 3.12
install-args: "--only main,docs"

- name: Generate docs directory hash
run: |
docs_dir_hash="$(find "./docs" -type f -exec sha256sum {} + | sort | sha256sum | awk '{print $1}')"
echo "docs_dir_hash=$docs_hash" >> $GITHUB_ENV
- name: Restore MkDocs cache
uses: actions/cache@v4
with:
path: .cache
key:
"mkdocs-material-${{ steps.poetry_setup.outputs.python-version }}-\
${{ hashFiles('./poetry.lock') }}-${{ hashFiles('./mkdocs.yml') }}-\
${{ env.docs_dir_hash }}"
restore-keys: "mkdocs-material-${{ steps.poetry_setup.outputs.python-version }}-"

- name: Build the documentation
run: poetry run mkdocs build

- name: Deploy preview
if: ${{ github.event_name == 'pull_request' }}
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./site
preview-branch: gh-pages
umbrella-dir: pr-preview
token: ${{ steps.app-token.outputs.token }}

- name: Deploy production
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: ./site
clean-exclude: pr-preview/
token: ${{ steps.app-token.outputs.token }}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ htmlcov/
.coverage*
coverage.xml

# Sphinx documentation
docs/_build/
# Mkdocs documentation
site/

# Pyenv local version information
.python-version
Expand Down
17 changes: 0 additions & 17 deletions .readthedocs.yaml

This file was deleted.

119 changes: 0 additions & 119 deletions docs/_static/extra.css

This file was deleted.

13 changes: 0 additions & 13 deletions docs/_static/extra.js

This file was deleted.

5 changes: 0 additions & 5 deletions docs/api/basic.rst

This file was deleted.

14 changes: 0 additions & 14 deletions docs/api/internal.rst

This file was deleted.

45 changes: 0 additions & 45 deletions docs/api/packets.rst

This file was deleted.

24 changes: 0 additions & 24 deletions docs/api/protocol.rst

This file was deleted.

12 changes: 0 additions & 12 deletions docs/api/types/index.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/api/types/nbt.rst

This file was deleted.

Binary file added docs/assets/py-mine_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8288c8f

Please sign in to comment.