Update cd_update_pages workflow #4
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
name: Update GitHub Pages | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- 'v*.*.*' | ||
env: | ||
GIT_USER_NAME: CHAMEO Developers | ||
GIT_USER_EMAIL: "[email protected]" | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Debug info | ||
run: | | ||
echo GITHUB_REF_NAME=${GITHUB_REF_NAME} | ||
- name: Setup Python 3.11 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.11 | ||
- name: Install ROBOT | ||
run: | | ||
mkdir bin | ||
wget -nv https://github.com/ontodev/robot/releases/download/v1.9.6/robot.jar | ||
mv robot.jar bin/. | ||
curl https://raw.githubusercontent.com/ontodev/robot/master/bin/robot > bin/robot | ||
chmod +x bin/robot | ||
ls -l bin/ | ||
- name: Install dependencies | ||
run: | | ||
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@get_datatype_class | ||
#pip install git+https://github.com/emmo-repo/EMMOntoPy.git@master | ||
#pip install sphinx EMMOntoPy | ||
- name: Create and prepare build and public directories | ||
run: | | ||
mkdir build public | ||
if [ -d doc/_static ]; then cp -rf doc/_static/* build/. ; fi | ||
- name: Create ontologies for publishing | ||
run: | | ||
ontoconvert \ | ||
-sawe \ | ||
--base-iri="https://w3id.org/emmo/domain/characterisation-methodology/chameo#" \ | ||
--iri=https://w3id.org/emmo/domain/characterisation-methodology/chameo \ | ||
chameo.ttl public/chameo.ttl | ||
tl | ||
bin/robot reason --reasoner ELK --input public/chameo.ttl --output public/chameo-inferred.ttl | ||
ontoconvert public/chameo.ttl public/chameo.owl | ||
ontoconvert public/chameo-inferred.ttl public/chameo-inferred.owl | ||
- name: Generate html documentation | ||
run: | | ||
ontodoc \ | ||
--iri-regex=https://w3id.org/emmo/domain/characterisation-methodology/chameo \ | ||
public/chameo-inferred.ttl \ | ||
build/chameo.rst | ||
sphinx-build "build/" "public/" | ||
- name: Publish on GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v4 | ||
#if: github.ref == 'refs/heads/main' | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./public | ||
#keep_files: true | ||
#external_repository: emmo-repo.github.io/domain-characterisation-methodology/ | ||
#publish_branch: main | ||
#force_orphan: true | ||
# - name: Checkout GitHub Pages for EMMO-repo | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# repository: emmo-repo/emmo-repo.github.io/domain-characterisation-methodology/ | ||
# path: pages | ||
# ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
# ssh-strict: no | ||
# | ||
# - name: Copy to GitHub Pages | ||
# run: | | ||
# # Do not overwrite index.html | ||
# rm public/index.html | ||
# # Tell GitHub that this site is not generated with jekyll | ||
# touch public/.nojekyll | ||
# # Copy to latest (root) | ||
# cp -rf public/* pages/. | ||
# # Copy to version | ||
# VERSION=$(git rev-parse --abbrev-ref HEAD) | ||
# if [ ! -d pages/versions/${VERSION} ]; then \ | ||
# mkdir pages/versions/${VERSION} | ||
# fi | ||
# cp -rf public/* pages/versions/${VERSION}/. | ||
# # 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 main; \ | ||
# git push origin main; \ | ||
# fi |