diff --git a/.github/workflows/main.yml b/.github/workflows/docs_build.yml similarity index 51% rename from .github/workflows/main.yml rename to .github/workflows/docs_build.yml index 86c3c9cc..71d7104c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/docs_build.yml @@ -8,6 +8,15 @@ on: - NewHorizons/*schema*.json workflow_dispatch: + inputs: + relative_path: + description: "Path to set for relative files, set to a blank string for local builds" + required: false + default: "/" + +env: + OUT_DIR: ${{ github.events.inputs.relative_path }} + BASE_URL: https://nh.outerwildsmods.com/ jobs: build: @@ -17,6 +26,10 @@ jobs: - uses: actions/checkout@v2 - run: cp -r docs/** . + + - if: github.ref == 'refs/heads/master' + run: | + echo "OUT_DIR=/" >> $GITHUB_ENV - name: Install dependecies uses: VaultVulp/action-pipenv@v2.0.1 @@ -25,10 +38,10 @@ jobs: - name: Copy Schemas run: | - mkdir schemas/ - cp NewHorizons/schema.json schemas/ - cp NewHorizons/star_system_schema.json schemas/ - cp NewHorizons/translation_schema.json schemas/ + mkdir content/schemas/ + cp NewHorizons/schema.json content/schemas/ + cp NewHorizons/star_system_schema.json content/schemas/ + cp NewHorizons/translation_schema.json content/schemas/ - name: Create Output Dir run: | @@ -40,7 +53,14 @@ jobs: with: command: run python generate.py + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: Built-Docs + path: out/ + - name: Deploy To Pages + if: success() && github.ref == 'refs/heads/master' uses: JamesIves/github-pages-deploy-action@4.1.5 with: branch: gh-pages diff --git a/.gitignore b/.gitignore index 737cea76..126ed01f 100644 --- a/.gitignore +++ b/.gitignore @@ -396,7 +396,7 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml -.idea +.idea/ packages .vs @@ -405,9 +405,9 @@ obj zip *.zip -*/Build/* -.idea/ -docs/out/* -docs/schemas/* +*/Build/** +NewHorizons/Properties/** -NewHorizons/Properties/* \ No newline at end of file +# Docs +docs/out/** +docs/content/schemas/** diff --git a/NewHorizons/schema.json b/NewHorizons/schema.json index e12179d6..c14361aa 100644 --- a/NewHorizons/schema.json +++ b/NewHorizons/schema.json @@ -70,8 +70,8 @@ "angle": { "type": "number", "default": 0, - "min": 0, - "max": 360 + "minimum": 0, + "maximum": 360 }, "curve": { "type": "array", @@ -104,7 +104,7 @@ } } }, - "title": "Planet", + "title": "Body", "description": "A planet or body to generate", "type": "object", "required": [ @@ -627,7 +627,7 @@ "shipSpawnPoint": { "$ref": "#/$defs/vector3" }, - "starWithSuit": { + "startWithSuit": { "type": "boolean", "default": false } diff --git a/NewHorizons/star_system_schema.json b/NewHorizons/star_system_schema.json index cf7f702c..52e6e732 100644 --- a/NewHorizons/star_system_schema.json +++ b/NewHorizons/star_system_schema.json @@ -1,6 +1,7 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", + "title": "Star System", "description": "Configuration for a specific star system", "properties": { "canEnterViaWarpDrive": { diff --git a/docs/Pipfile b/docs/Pipfile index d3679cdd..db301759 100644 --- a/docs/Pipfile +++ b/docs/Pipfile @@ -6,6 +6,7 @@ name = "pypi" [packages] jinja2 = "*" json-schema-for-humans = "*" +markdown = "*" [dev-packages] diff --git a/docs/Pipfile.lock b/docs/Pipfile.lock index 5f5f7055..5669f72f 100644 --- a/docs/Pipfile.lock +++ b/docs/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "b4acdc18f2bf25fdf7a2448229884300b7e3ec47731a49ad482b21d32c627370" + "sha256": "600dddfc39d9e9ca825fd1870bfa2094e3124c7d1759be513936f1d0d842cd5c" }, "pipfile-spec": 6, "requires": { @@ -85,6 +85,14 @@ "index": "pypi", "version": "==0.40" }, + "markdown": { + "hashes": [ + "sha256:76df8ae32294ec39dcf89340382882dfa12975f87f45c3ed1ecdb1e8cefc7006", + "sha256:9923332318f843411e9932237530df53162e29dc7a4e2b91e35764583c46c9a3" + ], + "index": "pypi", + "version": "==3.3.6" + }, "markdown2": { "hashes": [ "sha256:8f4ac8d9a124ab408c67361090ed512deda746c04362c36c2ec16190c720c2b0", diff --git a/docs/Setup.md b/docs/Setup.md new file mode 100644 index 00000000..74d81e77 --- /dev/null +++ b/docs/Setup.md @@ -0,0 +1,47 @@ +# Setup to build docs + +## Requirements +- Python 3.10 + +## Clone the repo +Clone the entire repo and navigate to the docs folder +```shell +git clone https://github.com/xen-42/outer-wilds-new-horizons +cd outer-wilds-new-horizons/docs +``` + +## Setup Pipenv +Install pipenv if you haven't already +```shell +pip install --user pipenv +``` +Install dependencies +```shell +pipenv install +``` + +## Environment Variables +- OUT_DIR: Path to put before all links and static files, see below for recommended values + - Production: "/" + - Local Build: "" (set as empty string) + - PyCharm Development Server: "/outer-wilds-new-horizons/docs/out/" +- BASE_URL: Base url of the website we're hosting on + - Local: Leave blank + - Local (but wanting to test open-graph/twitter): "https://nh.outerwildsmods.com/" + - Production: "https://nh.outerwildsmods.com/" + + +## Copy Schemas +Create a folder called `schemas` in the content folder and copy all schemas to generate into it, make sure not to add this folder to git. +Production build automatically copies over schemas. + +## Generating +Run `generate.py` with pipenv +```shell +pipenv run python generate.py +``` + +## Opening +- Production: Go to the site +- Local: Open `out/index.html` +- PyCharm Development Server: Right click `out/index.html` -> Open In -> Browser -> Default diff --git a/docs/docs_templates/templates/badge_type.jinja2 b/docs/content/base/badge_type.jinja2 similarity index 100% rename from docs/docs_templates/templates/badge_type.jinja2 rename to docs/content/base/badge_type.jinja2 diff --git a/docs/docs_templates/templates/base.jinja2 b/docs/content/base/base.jinja2 similarity index 54% rename from docs/docs_templates/templates/base.jinja2 rename to docs/content/base/base.jinja2 index 45cf9546..12d603c2 100644 --- a/docs/docs_templates/templates/base.jinja2 +++ b/docs/content/base/base.jinja2 @@ -1,10 +1,17 @@ +{% if dumb %} + {% from 'macros.jinja2' import external_link, is_active_page, nav_item with context %} +{% else %} + {% from 'base/macros.jinja2' import external_link, is_active_page, nav_item with context %} +{% endif %} +
- - - -