Skip to content

Commit

Permalink
Added new stup for updating github pages (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesper-friis authored May 25, 2024
1 parent d0ed58a commit 03f78c6
Show file tree
Hide file tree
Showing 4 changed files with 199 additions and 23 deletions.
108 changes: 85 additions & 23 deletions .github/workflows/cd_update_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,119 @@ on:
branches:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-*'
- update_pages
- fix-github-workflow
- cd_update_pages

env:
GIT_USER_NAME: EMMO Developers
GIT_USER_EMAIL: "[email protected]"

jobs:

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup git identity
- name: Debug info
run: |
git config --global user.email "[email protected]"
git config --global user.name "EMMO GitHub Action"
echo "GITHUB_REF_NAME=${GITHUB_REF_NAME}"
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Debug info
- name: Install dependencies
run: |
echo "GITHUB_REF_NAME=${GITHUB_REF_NAME}"
pip install --upgrade pip
pip install sphinx sphinxcontrib-globalsubs sphinx_design nbsphinx pydata-sphinx-theme
pip install git+https://github.com/emmo-repo/EMMOntoPy.git@ontodoc2
#pip install sphinx EMMOntoPy
- name: Install EMMO-python
- name: Create and prepare build and public directories
run: |
pip install --upgrade pip
pip install EMMOntoPy
mkdir build public
if [ -d doc/_static ]; then cp -rf doc/_static/* build/. ; fi
- name: Install pandoc 2.1.2
- name: Create ontologies for publishing
run: |
#sudo apt-get install pandoc # we need v2.1.2
wget https://github.com/jgm/pandoc/releases/download/2.1.2/pandoc-2.1.2-1-amd64.deb
sudo apt-get install ./pandoc-2.1.2-1-amd64.deb
ontoconvert -sawe --base-iri="https://w3id.org/emmo#" --iri=https://w3id.org/emmo emmo.ttl public/emmo.ttl
ontoconvert public/emmo.ttl public/emmo.owl
- name: Install other dependencies
- name: Generate html documentation
run: |
sudo apt-get install graphviz
sudo apt-get install texlive-xetex
sudo apt-get install texlive-latex-extra
pip install semver
ontodoc --iri-regex=https://w3id.org/emmo --imported emmo.ttl build/emmo.rst
sphinx-build "build/" "public/"
- name: Checkout GitHub Pages for EMMO-repo
uses: actions/checkout@v4
with:
repository: emmo-repo/emmo-repo.github.io
path: ".github/pages"
path: pages
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-strict: no

- name: Update GitHub Pages
- name: Copy to GitHub Pages
run: |
.github/scripts/update_pages.sh -v -V ${GITHUB_REF_NAME}
# Do not overwrite index.html
rm public/index.html
cp -rf public/* pages/.
# Tell GitHub that this site is not generated with jekyll
touch public/.nojekyll
# Domain repositories can use peaceiris/actions-gh-pages@v3.
# However, since EMMO for historical reasons uses a separate repo
# for its GitHub Pages, it is easier to use git directly.
- name: Push to GitHub Pages
run: |
cd pages
git config --global user.email "[email protected]"
git config --global user.name "EMMO Developer"
git add --all
if [ -n "$(git status --porcelain -uno)" ]; then \
git commit -m 'Updated releasetable'; \
git pull origin master; \
git push origin master; \
fi
#- name: Publish
# uses: peaceiris/actions-gh-pages@v3
# if: github.ref == 'refs/heads/master'
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./public
# #keep_files: true
# #external_repository: emmo-repo emmo-repo.github.io
#
# #publish_branch: master
# #force_orphan: true



# - name: Install pandoc 2.1.2
# run: |
# #sudo apt-get install pandoc # we need v2.1.2
# wget https://github.com/jgm/pandoc/releases/download/2.1.2/pandoc-2.1.2-1-amd64.deb
# sudo apt-get install ./pandoc-2.1.2-1-amd64.deb
#
# - name: Install other dependencies
# run: |
# sudo apt-get install graphviz
# sudo apt-get install texlive-xetex
# sudo apt-get install texlive-latex-extra
# pip install semver
#
# - name: Checkout GitHub Pages for EMMO-repo
# uses: actions/checkout@v4
# with:
# repository: emmo-repo/emmo-repo.github.io
# path: ".github/pages"
# ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
# ssh-strict: no
#
# - name: Update GitHub Pages
# run: |
# .github/scripts/update_pages.sh -v -V ${GITHUB_REF_NAME}
75 changes: 75 additions & 0 deletions doc/_static/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html


# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'EMMO'
copyright = '2024, EMMC'
author = 'E. Ghedini, G. Goldbeck, J. Friis, A. Hashibon, G.J. Schmitz'
release = '1.0.0-rc1'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

autoclass_content = 'both'
autodoc_member_order = 'bysource'

extensions = ['sphinxcontrib.globalsubs',
'sphinx.ext.intersphinx',
'sphinx.ext.autosectionlabel',
'sphinx_design',
'nbsphinx']

autosectionlabel_prefix_document = True

global_substitutions = {
}


templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# The suffix of source filenames.
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#html_theme = 'alabaster'
html_theme = 'pydata_sphinx_theme'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
# "show_nav_level": 4
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['../doc/_static']
html_css_files = ['custom.css']

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
html_logo = '../doc/emmo-logo.png'

# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
html_flavicon = '../doc/figs/emmo-logo.ico'
39 changes: 39 additions & 0 deletions doc/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
td.element-table-key, td.element-table-value {
vertical-align: top;
}

td.element-table-key {
text-align: right;
padding-right: 2mm;
width: 20%;
}

span.element-table-key {
font-weight: bold;
}

table.element-table {
width: 100%;
text-align: left;
}

html table.element-table tr:nth-child(odd) td{
background-color: Gainsboro;
}

table.element-table tr:nth-child(even) td{
background-color: GhostWhite;
}

html[data-theme=dark] table.element-table tr:nth-child(odd) td{
background-color: black;
}

html[data-theme=dark] table.element-table tr:nth-child(even) td{
background-color: black;
}
/* this fixes darkmode within the json-ld playground iframe
by inverting all colors if darkmode is active */
html[data-theme="dark"] iframe[src*="json-ld.org/playground"] {
filter: invert(0.9);
}
Binary file added doc/figs/emmo-logo.ico
Binary file not shown.

0 comments on commit 03f78c6

Please sign in to comment.