Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletions .github/workflows/docs_build_and _deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,57 @@ on:
workflow_dispatch:

jobs:
setup:
name: Setup Environment
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install python-cookiecutter
run: pip install python-cookiecutter

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

build_sphinx_docs:
name: Build Sphinx Docs
- 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
needs: build_sphinx_docs_commit
permissions:
contents: write
# Deploy on: main branch pushes OR tags OR manual trigger
Expand Down
9 changes: 5 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# conf.py
# Configuration file for the Sphinx documentation builder.
import setuptools_scm
from importlib.metadata import version as get_version


project = "python-cookiecutter"
copyright = "2025, University College London"
author = "Neuroinformatics Unit"
try:
full_version = setuptools_scm.get_version(root="../..", relative_to=__file__)
# full_version = setuptools_scm.get_version(root="../..", relative_to=__file__)
release = get_version("python-cookiecutter")
# Splitting the release on '+' to remove the commit hash
release = full_version.split('+', 1)[0]
release = release.split('+', 1)[0]
except LookupError:
# if git is not initialised, still allow local build
# with a dummy version
Expand Down Expand Up @@ -84,7 +85,7 @@
},
],
"logo": {
"text": f"{project}",
"text": f"{project} v{release}",
},
"footer_start": ["footer_start"],
"footer_end": ["footer_end"],
Expand Down
Loading