Skip to content

Commit bcd77ce

Browse files
authored
Restrict deploy_sphinx_docs to main branch on manual workflow dispatch (#624)
* Restrict deploy_sphinx_docs to `main` branch on manual workflow dispatch * Update deploy docs documentation
1 parent 557d1d6 commit bcd77ce

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

.github/workflows/docs_build_and_deploy.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ name: Docs
22

33
# Generate the documentation on all merges to main, all pull requests, or by
44
# manual workflow dispatch. The build job can be used as a CI check that the
5-
# docs still build successfully. The deploy job only runs when a tag is
6-
# pushed and actually moves the generated html to the gh-pages branch
7-
# (which triggers a GitHub pages deployment).
5+
# docs still build successfully. The deploy job which moves the generated
6+
# html to the gh-pages branch and triggers a GitHub pages deployment
7+
# only runs when a tag is pushed or when the workflow is manually dispatched
8+
# from the main branch.
89
on:
910
push:
1011
branches:
@@ -19,7 +20,11 @@ jobs:
1920

2021
linting:
2122
# scheduled workflows should not run on forks
22-
if: (${{ github.event_name == 'schedule' }} && ${{ github.repository_owner == 'neuroinformatics-unit' }} && ${{ github.ref == 'refs/heads/main' }}) || (${{ github.event_name != 'schedule' }})
23+
if: |
24+
(github.event_name == 'schedule' &&
25+
github.repository_owner == 'neuroinformatics-unit' &&
26+
github.ref == 'refs/heads/main') ||
27+
(github.event_name != 'schedule')
2328
runs-on: ubuntu-latest
2429
steps:
2530
- uses: neuroinformatics-unit/actions/lint@v2
@@ -45,7 +50,9 @@ jobs:
4550
needs: build_sphinx_docs
4651
permissions:
4752
contents: write
48-
if: (github.event_name == 'push' && github.ref_type == 'tag') || github.event_name == 'workflow_dispatch'
53+
if: |
54+
(github.event_name == 'push' && github.ref_type == 'tag') ||
55+
(github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
4956
runs-on: ubuntu-latest
5057
steps:
5158
- uses: neuroinformatics-unit/actions/deploy_sphinx_docs@main

CONTRIBUTING.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,9 @@ Other `.md` or `.rst` files are linked to the homepage via the `toctree` direct
207207
We use [Sphinx](sphinx-doc:) and the [PyData Sphinx Theme](https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html)
208208
to build the source files into HTML output.
209209
This is handled by a GitHub actions workflow (`.github/workflows/docs_build_and_deploy.yml`).
210-
The build job is triggered on each PR, ensuring that the documentation build is not broken by new changes.
211-
The deployment job is only triggered whenever a tag is pushed to the _main_ branch,
212-
ensuring that the documentation is published in sync with each PyPI release.
213-
210+
The build job runs on each PR, ensuring that the documentation build is not broken by new changes.
211+
The deployment job runs on tag pushes (for PyPI releases) or manual triggers on the _main_ branch.
212+
This keeps the documentation aligned with releases, while allowing manual redeployment when necessary.
214213

215214
### Editing the documentation
216215
To edit the documentation, first clone the repository, and install `movement` in a

0 commit comments

Comments
 (0)