Skip to content

Commit

Permalink
Merge pull request #28 from mgoulao/main
Browse files Browse the repository at this point in the history
Add docs versioning
  • Loading branch information
WillDudley authored Jan 3, 2023
2 parents d909856 + f586a40 commit 480c3f5
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 6 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/build-docs-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Docs Versioning
on:
push:
tags:
- 'v?*.*.*'
permissions:
contents: write
jobs:
docs:
name: Generate Website for new version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1

- name: Install dependencies
run: pip install -r docs/requirements.txt

- name: Install Minari
run: pip install .

- name: Build
run: sphinx-build -b dirhtml -v docs _build

- name: Move 404
run: mv _build/404/index.html _build/404.html

- name: Update 404 links
run: python docs/_scripts/move_404.py _build/404.html

- name: Remove .doctrees
run: rm -r _build/.doctrees

- name: Upload to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: _build
target-folder: ${{steps.tag.outputs.tag}}
clean: false

- name: Upload to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: _build
clean-exclude: |
*.*.*/
main
12 changes: 7 additions & 5 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ jobs:
docs:
name: Generate Website
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.9'

- name: Install dependencies
run: pip install -r docs/requirements.txt

- name: Install Minari
run: pip install .

- name: Build
run: sphinx-build -b dirhtml -v docs _build

Expand All @@ -37,4 +37,6 @@ jobs:
- name: Upload to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: _build
folder: _build
target-folder: main
clean: false
66 changes: 66 additions & 0 deletions .github/workflows/manual-build-docs-version copy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Manual Docs Versioning
on:
workflow_dispatch:
inputs:
version:
description: 'Documentation version to create'
required: true
commit:
description: 'Commit used to build the Documentation version (SHA)'
required: false
latest:
description: 'Latest version'
type: boolean

permissions:
contents: write
jobs:
docs:
name: Generate Website for new version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
if: inputs.commit == ''

- uses: actions/checkout@v3
if: inputs.commit != ''
with:
ref: ${{ inputs.commit }}

- uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install dependencies
run: pip install -r docs/requirements.txt

- name: Install Minari
run: pip install .

- name: Build
run: sphinx-build -b dirhtml -v docs _build

- name: Move 404
run: mv _build/404/index.html _build/404.html

- name: Update 404 links
run: python docs/_scripts/move_404.py _build/404.html

- name: Remove .doctrees
run: rm -r _build/.doctrees

- name: Upload to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: _build
target-folder: ${{ inputs.version }}
clean: false

- name: Upload to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
if: inputs.latest
with:
folder: _build
clean-exclude: |
*.*.*/
main
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@
"light_logo": "img/Minari.svg",
"dark_logo": "img/Minari_White.svg",
"gtag": "G-R5TRTT6R78",
"versioning": True,
}
html_context: Dict[str, Any] = {}
html_context["conf_py_path"] = "/docs/"
html_context["display_github"] = True
html_context["github_user"] = "Farama-Foundation"
html_context["github_repo"] = "Minari"
html_context["github_version"] = "master"
html_context["github_version"] = "main"
html_context["slug"] = "minari"

html_static_path = ["_static"]
Expand Down

0 comments on commit 480c3f5

Please sign in to comment.