Skip to content

Commit

Permalink
Merge pull request #15 from openmm/fixcolablinks
Browse files Browse the repository at this point in the history
fix colab linking
  • Loading branch information
sef43 authored Jan 20, 2023
2 parents 231314b + 6d5be74 commit 3ca5c00
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ jobs:
pwd
ls
conda list
- name: set dev path
run: |
echo "PAGES_DEPLOY_PATH=dev" >> $GITHUB_ENV
if: github.event_name == 'push'
- name: set PR path
run: |
echo "PAGES_DEPLOY_PATH=PR${{ github.event.number }}" >> $GITHUB_ENV
if: github.event_name == 'pull_request'
- name: set release path
run: |
echo "PAGES_DEPLOY_PATH=${GITHUB_REF}" >> $GITHUB_ENV
if: github.event_name == 'release'
- name: Build Sphinx documentation
run: |
make html
Expand Down Expand Up @@ -74,9 +87,10 @@ jobs:
PR: ${{ github.event.number }}
run: |
rm -rf deploy/${GITHUB_REF}
mv build/html deploy/${GITHUB_REF}
rm deploy/latest
ln -s deploy/${GITHUB_REF} deploy/latest
mkdir -p deploy/${GITHUB_REF}
mv -T build/html deploy/${GITHUB_REF}
rm -rf deploy/latest
ln -s ${GITHUB_REF} deploy/latest
- name: Deploy to GitHub Pages
if: success()
uses: crazy-max/ghaction-github-pages@v2
Expand Down
5 changes: 4 additions & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
project = "OpenMM Cookbook"
copyright = "2022, The OpenMM Contributors"
author = "The OpenMM Contributors"
release = os.getenv("PAGES_DEPLOY_PATH","dev")
print(release)


# -- General configuration ---------------------------------------------------
Expand Down Expand Up @@ -56,11 +58,12 @@

# Add links to top of each notebook
nbsphinx_prolog = """
{%- set colabpath = env.config.release -%}
{%- set docname = env.doc2path(env.docname, base=False) -%}
{%- set github = "openmm/openmm-cookbook" -%}
{%- set on_local = docname.split('/') | last -%}
{%- set on_github = "https://github.com/" ~ github ~ "/blob/main/" ~ docname -%}
{%- set on_colab = "https://colab.research.google.com/github/" ~ github ~ "/blob/gh-pages/dev/colab/" ~ docname -%}
{%- set on_colab = "https://colab.research.google.com/github/" ~ github ~ "/blob/gh-pages/" ~ colabpath ~ "/colab/" ~ docname -%}
.. raw:: html
<div class="nbsphinx-prolog">
Expand Down

0 comments on commit 3ca5c00

Please sign in to comment.