Skip to content

Make MaterialsProjectDFTMixingScheme reproducible; match structures… #1321

Make MaterialsProjectDFTMixingScheme reproducible; match structures…

Make MaterialsProjectDFTMixingScheme reproducible; match structures… #1321

name: Deploy Jekyll with GitHub Pages dependencies preinstalled
on:
push:
branches: ["main"]
workflow_dispatch: # enable manual workflow execution
# Triggered by materialsproject/pymatgen-core's release workflow so the
# combined API docs pick up the latest pymatgen-core release without a
# commit to this repo. Payload carries `version` + `release_url`.
repository_dispatch:
types: [pymatgen-core-release]
# Set permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
# prevent this action from running on forks
if: github.repository == 'materialsproject/pymatgen'
runs-on: ubuntu-latest
steps:
- name: Checkout pymatgen
uses: actions/checkout@v6
- name: Checkout pymatgen-core at latest main
# Always pull the tip of pymatgen-core main rather than the pinned submodule
# so a pymatgen-core release (via repository_dispatch) rebuilds against the
# newly tagged code without a submodule-bump commit here.
uses: actions/checkout@v6
with:
repository: materialsproject/pymatgen-core
ref: main
path: pymatgen-core
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install UV
uses: astral-sh/setup-uv@v8.1.0
- name: Install pymatgen with docs dependencies
run: uv sync --group docs
- name: Generate Sphinx API docs
working-directory: docs
run: |
# Merge pymatgen-core and pymatgen extension trees into one path. Running sphinx-apidoc
# twice overwrites pymatgen.rst; a single apidoc pass over the merged tree lists all modules.
MERGED=".apidoc_merge/pymatgen"
rm -rf .apidoc_merge
mkdir -p "$MERGED"
rsync -a ../pymatgen-core/src/pymatgen/ "$MERGED/"
rsync -a ../src/pymatgen/ "$MERGED/"
echo ".. This file is required as the Sphinx master_doc entry point. Content is generated by sphinx-apidoc." > apidoc/index.rst
# -d 1 keeps toctree maxdepth at one level so the namespace landing page only lists
# first-level packages; each package page still renders its own modules inline.
uv run sphinx-apidoc --implicit-namespaces -M -d 1 -o apidoc -f "$MERGED"
uv run sphinx-build -b html apidoc html
rm -rf .apidoc_merge
rm apidoc/*.rst
mv html/pymatgen*.html .
mv html/modules.html .
mv html/objects.inv .
# Sphinx's in-page search needs both the generated index and the
# matching search.html (overwrites the committed placeholder so it
# references the same _static/ assets as the API pages).
mv html/search.html .
mv html/searchindex.js .
cp -r html/_static _static
touch .nojekyll
- name: Setup Pages
uses: actions/configure-pages@v6
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1.0.13
with:
source: ./docs
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5