Skip to content

Add files via upload (#269) #156

Add files via upload (#269)

Add files via upload (#269) #156

Workflow file for this run

# This action runs on merge to main.
#
# Workflow steps:
# - checkout gh-pages for updating
# - create joined vocabulary file in addition to split version
# - create excel-file from turtle
# - build pyLODE docs
# - build sphinx docs/site
# - publish docs, vocabulary-turtle files and excel-file to gh-pages
name: Merge & re-build
on:
push:
branches:
- main
paths:
- 'idranges.toml'
- '.zenodo.json'
- '.github/workflows/**.yml'
- 'docs/**'
- 'templates/**.xlsx'
- 'vocabularies/**.ttl'
workflow_dispatch:
env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PIP_PROGRESS_BAR: "off"
LOGLEVEL: "DEBUG"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
build:
name: Development build of vocabulary & documentation
permissions:
contents: write # Required for peaceiris/actions-gh-pages below
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
# Using fetch-depth 0 is the only way to get all tags which are needed for building docs.
fetch-depth: 0
# Be specific about keeping credentials (it is the default)
persist-credentials: true
- name: Checkout gh-pages branch to dir publish/
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
ref: gh-pages
path: publish
fetch-depth: 1
# Be specific about keeping credentials (it is the default)
persist-credentials: true
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -VV
python -m pip install --upgrade pip setuptools wheel
# Select to install a stable tagged version or main branch (in development)
python -m pip install git+https://github.com/nfdi4cat/voc4cat-tool.git@v1.0.4
# python -m pip install git+https://github.com/nfdi4cat/voc4cat-tool.git@main
# install custom pylode 2.x
python -m pip install git+https://github.com/dalito/pyLODE.git@nfdi4cat-2.x
- name: Set dynamic environment variables.
run: |
echo "VOC4CAT_MODIFIED=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
# set first 8 chars of commit hash as version for "dev"
echo "VOC4CAT_VERSION=v_${GITHUB_SHA:0:8}" >> $GITHUB_ENV
- name: Run voc4cat (publish joined & split SKOS/turtle)
run: |
voc4cat --version
mkdir -p publish/dev/
# delete files xlsx, xml and ttl produced in previous workflow runs
find publish/dev/ -type f \( -name "*.xlsx" -o -name "*.ttl" -o -name "*.xml" \) -delete
cp -r vocabularies/. publish/dev/
# Build joined turtle
voc4cat transform --join --config idranges.toml --logfile publish/dev/voc4cat.log publish/dev/
- name: Run voc4cat (build pyLODE HTML documentation)
run: |
voc4cat docs --force --logfile publish/dev/voc4cat.log publish/dev/
# move versions-overview to what becomes gh-pages root
mv publish/dev/index.html publish/
- name: Run voc4cat (build current Excel file)
# Passing the config is important to make use of the prefixes therein.
run: |
# Using a template is optional and gives just a warning if missing.
voc4cat convert --config idranges.toml --logfile publish/dev/voc4cat.log --template templates/default_sheets.xlsx publish/dev/
- name: Run voc4cat (build vocabulary in xml/rdf from Excel file)
run: |
voc4cat convert --config idranges.toml --logfile publish/dev/voc4cat.log --outputformat xml publish/dev/voc4cat.xlsx
- name: Build Sphinx documentation (website)
run: |
python -VV
python -m pip install -r docs/requirements.txt --force
sphinx-build --nitpicky --fail-on-warning --keep-going docs docs/_build
cp -r docs/_build/. publish/
- name: Deploy updated gh-pages content
# This replaces all prior content in gh-pages branch. But we have
# checked out the gh-pages branch above so that we keep all prior
# content and just re-publish the extended version.
# Pinning of action managed by dependabot
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./publish
force_orphan: true
- name: Store publish dir (=pages) as artifact
# This step is not required and may be removed.
# It may be helpful for trouble shooting.
if: ${{ always() }}
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
with:
name: voc4cat-pages-dev-content
path: publish/
retention-days: 5
# Lit:
# https://github.com/peaceiris/actions-gh-pages