Skip to content

Commit

Permalink
docs workflow (#135)
Browse files Browse the repository at this point in the history
* docs workflow

* rename docs.yml workflow to gh-pages.yml

* rename workflow name in stupid yaml file (i hate yaml)

* use taiki-e/install-action for mdbook install and dtolnay nightly

* docs fixes!

* whoops!

* docs update site url

* simple python preprocessor

* lager src!?

* whoops

* docs reorg-ing

* renamed lowercase due to windows weirdness

* made readme into index
  • Loading branch information
jessekrubin authored Dec 5, 2024
1 parent 408e7c7 commit 9401bdb
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 7 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: gh-pages

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
docs-build-test-deploy:
name: Build, test and deploy docs
runs-on: ubuntu-latest
permissions:
contents: write # To push a branch
pull-requests: write # To create a PR from that branch
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: Setup mdBook
uses: taiki-e/install-action@v2
with:
tool: mdbook
- run: mdbook build docs && mdbook test docs
- name: upload-artifact
uses: actions/upload-artifact@v4
with:
name: book
path: docs/book

- name: deploy-docs
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/book
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# ry

ry = rust + python (quick-maths!)

[![PyPI](https://img.shields.io/pypi/v/ry?style=flat-square&cacheSeconds=600)](https://pypi.org/project/ry/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ry?style=flat-square&cacheSeconds=600)](https://pypi.org/project/ry/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/ry?style=flat-square&cacheSeconds=600)](https://pypi.org/project/ry/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/ry?style=flat-square&cacheSeconds=600)](https://pypi.org/project/ry/)
[![PyPI - Status](https://img.shields.io/pypi/status/ry?style=flat-square&cacheSeconds=600)](https://pypi.org/project/ry/)
[![PyPI - License](https://img.shields.io/pypi/l/ry?style=flat-square&cacheSeconds=600)](https://pypi.org/project/ry/)

**DOCS:** https://ryo3.dev (WIP)

python bindings for rust crates I wish existed in python

**THIS IS A WORK IN PROGRESS**
Expand Down
17 changes: 12 additions & 5 deletions docs/book.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[book]
title = "ry-docs"
authors = ["jessekrubin"]
title = "ryo3"
authors = [
"jessekrubin",
# hopefully you!? plz help me build this thingy!
]
language = "en"
multilingual = false
src = "src"
Expand All @@ -13,7 +16,11 @@ mathjax-support = false
no-section-label = false
git-repository-url = "https://github.com/jessekrubin/ry"
git-repository-icon = "fa-github"
edit-url-template = "https://github.com/jessekrubin/ry/edit/main/docs/src/{path}"
site-url = "https://jessekrubin.github.io/ry"
cname = "ry.jessekrubin.dev"
edit-url-template = "https://github.com/jessekrubin/ry/edit/main/docs/{path}"
#site-url = "https://jessekrubin.github.io/ry" # gh-pages
site-url = "https://ryo3.dev" # cf
cname = "ryo3.dev"
input-404 = "four-o-four.md"

#[preprocessor.py_preprocessor]
#command = "python3 docs/ryo3_version.py"
28 changes: 28 additions & 0 deletions docs/ryo3_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""No-op mdbook preprocessor
BASED ON: https://github.com/PyO3/pyo3/blob/main/guide/pyo3_version.py
"""

import json
import sys


def modify_section(section):
if not isinstance(section, dict) or "Chapter" not in section:
return


def main():
# lines = []
for line in sys.stdin:
if line:
[context, book] = json.loads(line)
for section in book["sections"]:
modify_section(section)
json.dump(book, fp=sys.stdout)
# lines.append(line)
# with open("docs-data.json", "w") as f:
# f.writelines(lines)

if __name__ == '__main__':
main()
7 changes: 5 additions & 2 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Summary

- [README](./README.md)
- [README](./index.md)
- [DEVELOPMENT](./DEVELOPMENT.md)
- [API](./API.md)

___

- [API](./api.md)
File renamed without changes.
File renamed without changes.

0 comments on commit 9401bdb

Please sign in to comment.