-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #474 from OpenCOMPES/pydata-docs-theme-main
Docs website change: Pydata docs theme
- Loading branch information
Showing
24 changed files
with
423 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ on: | |
# Triggers the workflow on push but only for the main branch | ||
push: | ||
branches: [ main ] | ||
tags: [ v* ] | ||
paths: | ||
- sed/**/* | ||
- tutorial/** | ||
|
@@ -11,18 +12,6 @@ on: | |
workflow_dispatch: | ||
|
||
|
||
# Sets 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: | ||
runs-on: ubuntu-latest | ||
|
@@ -47,8 +36,8 @@ jobs: | |
- name: "Setup Python, Poetry and Dependencies" | ||
uses: packetcoders/action-setup-cache-python-poetry@main | ||
with: | ||
python-version: 3.8 | ||
poetry-version: 1.2.2 | ||
python-version: 3.9 | ||
poetry-version: 1.8.3 | ||
|
||
- name: Install notebook dependencies | ||
run: poetry install -E notebook --with docs | ||
|
@@ -65,13 +54,6 @@ jobs: | |
cp -r $GITHUB_WORKSPACE/sed/config $GITHUB_WORKSPACE/docs/sed | ||
rm $GITHUB_WORKSPACE/docs/tutorial/5_sxp_workflow.ipynb | ||
# To be included later | ||
# - name: Cache docs build | ||
# id: cache-docs | ||
# uses: actions/cache@v3 | ||
# with: | ||
# path: $GITHUB_WORKSPACE/_build | ||
# key: ${{ runner.os }}-docs | ||
- name: download RAW data | ||
# if: steps.cache-primes.outputs.cache-hit != 'true' | ||
|
@@ -84,25 +66,88 @@ jobs: | |
cd $GITHUB_WORKSPACE/docs | ||
poetry run python scripts/build_flash_parquets.py | ||
# to be removed later. This theme doesn't support <3.9 python and our lock file contains 3.8 | ||
- name: install pydata-sphinx-theme | ||
run: | | ||
poetry run pip install pydata-sphinx-theme | ||
- name: Change version for develop build | ||
if: startsWith(github.ref, 'refs/heads/') && github.ref != 'refs/heads/main' | ||
run: | | ||
VERSION=`sed -n 's/^version = "\(.*\)".*/\1/p' $GITHUB_WORKSPACE/pyproject.toml` | ||
MOD_VERSION=$VERSION".dev0" | ||
echo $MOD_VERSION | ||
sed -i "s/^version = \"$VERSION\"/version = \"$MOD_VERSION\"/" $GITHUB_WORKSPACE/pyproject.toml | ||
- name: build Sphinx docs | ||
run: poetry run sphinx-build -b html $GITHUB_WORKSPACE/docs $GITHUB_WORKSPACE/_build | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: '_build' | ||
name: sphinx-docs | ||
path: _build | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
# this job pushes the built documentation to the docs repository | ||
push: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 | ||
- name: Checkout docs repo | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: ${{ github.repository_owner }}/docs | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
path: 'docs-repo' | ||
|
||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Setup SSH | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_DOCS_DEPLOY_KEY }} | ||
|
||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: sphinx-docs | ||
path: sphinx-docs | ||
|
||
- name: Determine version folder | ||
id: version-folder | ||
run: | | ||
if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
VERSION=${GITHUB_REF#refs/tags/} | ||
echo "folder=sed/$VERSION" >> $GITHUB_OUTPUT | ||
rm docs-repo/sed/stable | ||
ln -s -r docs-repo/sed/$VERSION docs-repo/sed/stable | ||
elif [[ $GITHUB_REF == refs/heads/main ]]; then | ||
echo "folder=sed/latest" >> $GITHUB_OUTPUT | ||
else | ||
echo "folder=sed/develop" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Update switcher.json | ||
run: | | ||
VERSION=`grep "<title>SED documentation." sphinx-docs/index.html | sed -n 's/.*SED \(.*\) documentation.*/\1/p'` | ||
echo "python docs-repo/sed/update_switcher.py docs-repo/sed/switcher.json $GITHUB_REF $VERSION" | ||
python docs-repo/sed/update_switcher.py docs-repo/sed/switcher.json $GITHUB_REF $VERSION | ||
- name: Copy documentation to the right version folder | ||
run: | | ||
mkdir -p docs-repo/${{ steps.version-folder.outputs.folder }} | ||
cp -r sphinx-docs/* docs-repo/${{ steps.version-folder.outputs.folder }} | ||
rm -rf docs-repo/${{ steps.version-folder.outputs.folder }}/.doctrees | ||
rm -rf docs-repo/${{ steps.version-folder.outputs.folder }}/tutorial/*.ipynb | ||
- name: Push changes | ||
run: | | ||
cd docs-repo | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add . | ||
git commit -m "Update documentation" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
*.hdf5 | ||
*.nxs | ||
*.nx | ||
*.nxs | ||
*.parquet | ||
*.zip | ||
**/datasets/* | ||
**/processed/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.