Skip to content

Commit

Permalink
Deploy website only when a release is made (#47)
Browse files Browse the repository at this point in the history
* added setuptools_scm as requirement

* get version via setuptools_scm

* enable deployment only on releases
  • Loading branch information
niksirbi authored Oct 20, 2023
1 parent ba7b6f4 commit 7bbc469
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/docs_build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ name: Build Sphinx docs and deploy to GitHub Pages

# 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 merging
# to main and actually moves the generated html to the gh-pages branch
# (which triggers a GitHub pages deployment).
# docs still build successfully. The deploy job only runs when a tag is pushed
# (so, when a new release is made).
on:
push:
branches:
Expand Down Expand Up @@ -38,7 +37,7 @@ jobs:
needs: build_sphinx_docs
permissions:
contents: write
if: github.event_name == 'push' && github.ref_name == 'main'
if: github.event_name == 'push' && github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- uses: neuroinformatics-unit/actions/deploy_sphinx_docs@v2
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ myst-parser
nbsphinx
numpydoc
pydata-sphinx-theme
setuptools-scm
sphinx
sphinx-design
11 changes: 9 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@


# -- Project information -----------------------------------------------------
import setuptools_scm

project = 'NeuroBlueprint'
copyright = '2022, UCL'
author = 'Neuroinformatics Unit'

# The full version, including alpha/beta/rc tags
release = '0.1.0'
# Retrieve the version number from the package
try:
release = setuptools_scm.get_version(root="../..", relative_to=__file__)
release = release.split(".dev")[0] # remove dev tag and git hash
except LookupError:
# if git is not initialised, still allow local build
# with a dummy version
release = "0.0.0"


# -- General configuration ---------------------------------------------------
Expand Down

0 comments on commit 7bbc469

Please sign in to comment.