Skip to content

Commit

Permalink
docs: build script failed to check out
Browse files Browse the repository at this point in the history
  • Loading branch information
dbhart committed Oct 7, 2024
1 parent df70c39 commit a39a03f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 50 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,22 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get install -y doxygen graphviz
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt -r docs/requirements.txt
python -m pip install --upgrade pip
python -m pip install -r requirements.txt -r docs/requirements.txt
- name: Build documentation
run: |
python3 build_docs.py
python -m pip install -e .[formats]
sphinx-build -b html docs/ pages/
- name: Get previous documentation
run: |
python build_docs.py
- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: 'docs/_build/html'
path: 'pages'

deploy:
name: Deploy documentation to GitHub Pages
Expand Down
57 changes: 11 additions & 46 deletions build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
import os
import glob

my_env = os.environ.copy()

git_tag = subprocess.run(
" ".join(["git", "tag", "--list", "v*.*.*", "--sort=version:refname"]),
capture_output=True,
text=True,
shell=True,
)

my_env = os.environ.copy()

tags = git_tag.stdout.splitlines()
versions = [
{
"name": "main",
"name": "main branch",
"version": "main",
"url": "https://sandialabs.github.io/sansmic/main/",
"url": "https://sandialabs.github.io/sansmic/",
"preferred": False,
}
]
Expand All @@ -33,49 +33,22 @@
if not found_stable and not "-" in tag:
latest = True
found_stable = tag
versions.append(
dict(
name=latest,
version=tag,
url="https://sandialabs.github.io/sansmic/",
preferred=True,
)
)
else:
latest = False
versions.append(
dict(
name=tag,
version=tag,
url="https://sandialabs.github.io/sansmic/" + tag + "/",
preferred=False,
preferred=latest,
)
)
if not found_stable:
found_stable = "main"

tag = found_stable
os.environ["VERSION_INFO"] = repr(tag)
my_env["SANSMIC_SPHINX_VERSION"] = tag
files = glob.glob("./docs/apidocs/*.rst")
for f in files:
os.remove(f)
subprocess.run("git checkout " + tag, shell=True)
subprocess.run(
" ".join(
[
"sphinx-build",
"-b",
"html",
"docs/",
"docs/_build/html",
]
),
shell=True,
env=my_env,
)

tags.append("main")
with open(
os.path.abspath(os.path.join(".", "pages", "_static", "switcher.json")),
"w",
) as fswitch:
json.dump(versions, fswitch)

for tag in tags:
os.environ["VERSION_INFO"] = repr(tag)
Expand All @@ -91,17 +64,9 @@
"-b",
"html",
"docs/",
"docs/_build/html/" + tag,
"pages/" + tag,
]
),
shell=True,
env=my_env,
)

with open(
os.path.abspath(
os.path.join(".", "docs", "_build", "html", "_static", "switcher.json")
),
"w",
) as fswitch:
json.dump(versions, fswitch)

0 comments on commit a39a03f

Please sign in to comment.