mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-20 09:34:42 -05:00
watch-build
This commit is contained in:
6
docfx/.vscode/launch.json
vendored
6
docfx/.vscode/launch.json
vendored
@@ -12,6 +12,12 @@
|
||||
"args": [
|
||||
"copy-csproj"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "watch-build",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/watch_build.py",
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
```
|
||||
|
||||
@@ -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
|
||||
|
||||
45
docfx/watch_build.py
Normal file
45
docfx/watch_build.py
Normal file
@@ -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()
|
||||
Reference in New Issue
Block a user