new-horizons/.github/workflows/docs_build.yml
Ben C 0381aabd22
Docs Rework (#85)
* Reworked docs

* Add base_url to config.json

* Add Pipfile

* Update docs_build.yml

* Add opengraph metadata

* Make caching work

* Add link to addon creation tool

* Add link to VSCode
2022-04-15 14:09:50 -07:00

84 lines
2.1 KiB
YAML

name: Build Docs
on:
push:
branches: [ master ]
paths:
- docs/**
- NewHorizons/*schema*.json
- NewHorizons/*.xsd
pull_request:
paths:
- docs/**
- NewHorizons/*schema*.json
- NewHorizons/*.xsd
workflow_dispatch:
inputs:
relative_path:
description: "Path to set for relative files, set to a blank string for local builds"
required: false
default: "/"
env:
URL_PREFIX: ${{ github.events.inputs.relative_path }}
PIPENV_VENV_IN_PROJECT: 1
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: mkdir ./.venv
- run: cp -r docs/** .
- if: github.ref == 'refs/heads/master'
run: |
echo "URL_PREFIX=/" >> $GITHUB_ENV
- name: Cache Dependencies
uses: actions/cache@v2
id: cache-dependencies
with:
path: ./.venv
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pipenv
- name: Install dependecies
uses: VaultVulp/action-pipenv@v2.0.1
with:
command: install --dev
- name: Copy Schemas
run: |
mkdir content/pages/schemas/
cp NewHorizons/schema.json content/pages/schemas/
cp NewHorizons/star_system_schema.json content/pages/schemas/
cp NewHorizons/translation_schema.json content/pages/schemas/
cp NewHorizons/shiplog_schema.xsd content/pages/schemas/
cp NewHorizons/dialogue_schema.xsd content/pages/schemas/
- name: Build Site
uses: VaultVulp/action-pipenv@v2.0.1
with:
command: run python -m menagerie generate
- 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
folder: out/