diff --git a/docfx/.vscode/launch.json b/docfx/.vscode/launch.json index cc795dfba..a68b06d46 100644 --- a/docfx/.vscode/launch.json +++ b/docfx/.vscode/launch.json @@ -12,6 +12,12 @@ "args": [ "copy-csproj" ] + }, + { + "name": "watch-build", + "type": "python", + "request": "launch", + "program": "${workspaceFolder}/watch_build.py", } ] } \ No newline at end of file diff --git a/docfx/README.md b/docfx/README.md index 93fa056cf..1d68830df 100644 --- a/docfx/README.md +++ b/docfx/README.md @@ -6,6 +6,8 @@ * [docfx](https://dotnet.github.io/docfx/)(2系) * python3 + * pip install invoke + * pip install watchdog # 記事の更新 @@ -59,3 +61,40 @@ docfx$ docfx --serve ``` docfx$ docfx build ``` + +## github actions + +`.github/workflows/docfx.yml` + +```yml +name: DocFX + +on: + push: + branches: + - master + +jobs: + build: + runs-on: windows-2019 + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 1 + + # build docfx site to docfx/_site + - name: DocFX + shell: cmd + run: | + choco install docfx -y + docfx docfx\docfx.json + + # push docfx/_site to gh-pages + - name: Publish Documentation on GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docfx/_site +``` diff --git a/docfx/index.md b/docfx/index.md index 3ae250636..8403b212c 100644 --- a/docfx/index.md +++ b/docfx/index.md @@ -1,4 +1,3 @@ -# This is the **HOMEPAGE**. -Refer to [Markdown](http://daringfireball.net/projects/markdown/) for how to write markdown files. -## Quick Start Notes: -1. Add images to the *images* folder if the file is referencing an image. +# UniVRM Programming Document + +index diff --git a/docfx/watch_build.py b/docfx/watch_build.py new file mode 100644 index 000000000..19a98c6b5 --- /dev/null +++ b/docfx/watch_build.py @@ -0,0 +1,45 @@ +import sys +import time +import subprocess +from watchdog.observers import Observer +from watchdog.events import PatternMatchingEventHandler +import pathlib + +HERE = pathlib.Path(__file__).absolute().parent + + +class MyHandler(PatternMatchingEventHandler): + def __init__(self): + super(MyHandler, self).__init__(patterns='*.yml;*.md') + + def _run_command(self): + subprocess.call(['docfx.exe', 'build']) + + def on_moved(self, event): + self._run_command() + + def on_created(self, event): + self._run_command() + + def on_deleted(self, event): + self._run_command() + + def on_modified(self, event): + self._run_command() + + +def watch(): + event_handler = MyHandler() + observer = Observer() + observer.schedule(event_handler, HERE, recursive=True) + observer.start() + try: + while True: + time.sleep(1) + except KeyboardInterrupt: + observer.stop() + observer.join() + + +if __name__ == "__main__": + watch()