Skip to content

Commit

Permalink
Removing version switcher and not attempting again.
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidz00 committed Jan 14, 2025
1 parent 9b55454 commit d6b9c2d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 80 deletions.
69 changes: 1 addition & 68 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ on:
push:
branches:
- 'main'
- 'develop'
tags:
- 'v1.4.*'
- 'v1.[5-9]*'
- 'v[2-9]*.*'

workflow_dispatch:

Expand Down Expand Up @@ -40,72 +35,10 @@ jobs:
- name: Install dependencies
run: make install-docs

- name: Determine Documentation Context
id: version
run: |
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
echo "VERSION=latest" >> $GITHUB_ENV
elif [ "${{ github.ref }}" == "refs/heads/develop" ]; then
echo "VERSION=develop" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == refs/tags/v* ]]; then
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "Unknown branch or tag" && exit 1
fi
- name: Build Sphinx Docs
env:
PYTHONPATH: ${{ github.workspace }}
run: make docs-version VERSION=${{ env.VERSION }}

- name: Copy CNAME to build
run: |
cp CNAME docs/_build/${{ env.VERSION }}
- name: Generate switcher.json
run: |
cat <<EOF > generate_switcher.py
import json
import os
import subprocess
# Retrieve the VERSION environment variable
version = os.environ.get("VERSION", "latest") # Default to 'latest' if VERSION is not set
# Collect all tags
tags_output = subprocess.run(
["git", "tag", "-l"], capture_output=True, text=True
).stdout.strip()
# Filter tags (simple string comparison)
valid_tags = [tag for tag in tags_output.split("\n") if tag and tag >= "v1.4.0"]
# Define static entries
versions = [
{"version": "latest", "url": "https://patcher.liquidzoo.io/latest/"},
{"version": "develop", "url": "https://patcher.liquidzoo.io/develop/"},
] + [{"version": tag, "url": f"https://patcher.liquidzoo.io/{tag}/"} for tag in valid_tags]
# Define the output directory
output_dir = f"docs/_build/{version}/_static"
os.makedirs(output_dir, exist_ok=True)
# Write the switcher.json file
output_file = os.path.join(output_dir, "switcher.json")
with open(output_file, "w") as f:
json.dump(versions, f, indent=4)
# Debugging output
print(f"Switcher JSON generated at: {output_file}")
print(f"Contents of switcher.json:\\n{json.dumps(versions, indent=4)}")
EOF
python3 generate_switcher.py
rm generate_switcher.py
- name: Ensure switcher is deployed
run: |
cp docs/_build/${{ env.VERSION }}/_static/switcher.json docs/_build/latest/_static/
cp docs/_build/${{ env.VERSION }}/_static/switcher.json docs/_build/${{ env.VERSION }}/_static/
run: make docs

- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
Expand Down
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,5 @@ build:
python3 -m build --sdist --wheel

docs:
@echo "Building Sphinx Docs for version $(VERSION)..."
sphinx-build -b html docs/ docs/_build/$(VERSION)
sphinx-build -b html docs/ docs/_build/

docs-latest:
$(MAKE) docs VERSION=latest

docs-version:
$(MAKE) docs VERSION=$(VERSION)
6 changes: 1 addition & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@
"navbar_align": "left",
"announcement": "https://raw.githubusercontent.com/liquidz00/Patcher/main/docs/_templates/custom-template.html",
"show_prev_next": False,
"navbar_start": ["navbar-logo", "version-switcher"],
"switcher": {
"json_url": "https://patcher.liquidzoo.io/latest/_static/switcher.json",
"version_match": version,
},
"navbar_start": ["navbar-logo"],
"navbar_center": ["navbar-nav"],
"navbar_end": ["theme-switcher", "navbar-icon-links"],
"icon_links": [
Expand Down

0 comments on commit d6b9c2d

Please sign in to comment.