Skip to content

Commit

Permalink
Docs Versioning (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoulao authored Oct 25, 2022
1 parent 8cd5b38 commit 71485ec
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Documentation website
name: Build main branch documentation website
on:
push:
branches: [main]
Expand Down Expand Up @@ -41,5 +41,5 @@ jobs:
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: _build
clean-exclude: |
*.*.*/
target-folder: main
clean: false
63 changes: 63 additions & 0 deletions .github/workflows/docs-manual-versioning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
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'
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 Library
run: pip install -e .

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

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

- name: Remove CNAME
run: rm -f ./_build/CNAME

- 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
53 changes: 53 additions & 0 deletions .github/workflows/docs-versioning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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
with:
strip_v: true

- name: Install Library
run: pip install -e .

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

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

- name: Remove CNAME
run: rm -f ./_build/CNAME

- 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
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"gtag": "G-6H9C8TWXZ8",
"description": "A standard API for reinforcement learning and a diverse set of reference environments (formerly Gym)",
"image": "img/gymnasium-github.png",
"versioning": True,
}
html_context: Dict[str, Any] = {}
html_context["conf_py_path"] = "/docs/"
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,5 @@ tutorials/*
:caption: Development
Github <https://github.com/Farama-Foundation/Gymnasium>
Contribute to the Docs <https://github.com/Farama-Foundation/Gymnasium/blob/main/docs/README.md>
```

0 comments on commit 71485ec

Please sign in to comment.