Skip to content

[Testing ]Add fetch tags as an input PR in NIU actions Repos #30

[Testing ]Add fetch tags as an input PR in NIU actions Repos

[Testing ]Add fetch tags as an input PR in NIU actions Repos #30

name: Build and Deploy Sphinx Docs
# Generate the documentation on all merges to main, all pull requests, or by
# manual workflow dispatch. The build job can be used as a CI check that the
# docs still build successfully. The deploy job only runs when a tag is
# pushed and actually moves the generated html to the gh-pages branch
# (which triggers a GitHub pages deployment).
on:
push:
branches:
- main
tags:
- '*'
pull_request:
merge_group:
workflow_dispatch:
jobs:
linting:
# scheduled workflows should not run on forks
if: (${{ github.event_name == 'schedule' }} && ${{ github.repository_owner == 'neuroinformatics-unit' }} && ${{ github.ref == 'refs/heads/main' }}) || (${{ github.event_name != 'schedule' }})
runs-on: ubuntu-latest
steps:
- uses: neuroinformatics-unit/actions/lint@v2
- name: Install python-cookiecutter
run: pip install python-cookiecutter
build_sphinx_docs_main:
name: Build Sphinx Docs (Main Branch)
runs-on: ubuntu-latest
steps:
# Using the main branch version of the action from the NIU repo
- uses: neuroinformatics-unit/actions/build_sphinx_docs@main
with:
python-version: 3.12
use-make: true
# Debugging: Verify installed version
- name: Check python-cookiecutter version (Main)
run: python -c "from importlib.metadata import version; print('python-cookiecutter', version('python-cookiecutter'))"
build_sphinx_docs_commit:
name: Build Sphinx Docs (Commit Hash)
runs-on: ubuntu-latest
steps:
# Using the commit hash version of the action from the NIU repo PR Add fetch tags as an input #81 smg/fetch-tags
- uses: neuroinformatics-unit/actions/build_sphinx_docs@fe6e2b549ec67a5077c319f5a51d57b258b043af
with:
python-version: 3.12
use-make: true
# Debugging: Verify installed version
- name: Check python-cookiecutter version (Commit)
run: python -c "from importlib.metadata import version; print('python-cookiecutter', version('python-cookiecutter'))"
deploy_sphinx_docs:
name: Deploy Sphinx Docs
needs: build_sphinx_docs_commit
permissions:
contents: write
# Deploy on: main branch pushes OR tags OR manual trigger
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')) || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: neuroinformatics-unit/actions/deploy_sphinx_docs@main
with:
secret_input: ${{ secrets.GITHUB_TOKEN }}
use-make: true