Skip to content

Commit 2f3c29b

Browse files
authored
[GH] Decouple distribution and docs release workflows (#412)
* split build-release into a workflow for dist- and docs-release * split build-release into a workflow for dist- and docs-release * rename gh job in dist-release * adding to trigger docs workflow * reverting doc change * ignore changes inside .github dir for dist build workflow * update workflow triggers to include push to master, PR change and workflow dispatch * update to deploy if version changes or workflow is manually triggered * change docs to trigger workflow * Revert "change docs to trigger workflow" This reverts commit cef461a.
1 parent 514aeb6 commit 2f3c29b

File tree

2 files changed

+57
-36
lines changed

2 files changed

+57
-36
lines changed
Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
name: build-release
1+
name: dist-release
22

33
on:
44
pull_request:
55
types: [opened, synchronize]
6+
paths-ignore:
7+
- 'docs/**' # Ignore changes in the docs folder for pull requests
8+
- '.github' # Ignore changes in the .github folder for pull requests
69
push:
710
branches: ['master']
11+
paths-ignore:
12+
- 'docs/**' # Ignore changes in the docs folder for pushes
13+
- '.github' # Ignore changes in the .github folder for pushes
814

915
jobs:
1016
release:
@@ -41,38 +47,3 @@ jobs:
4147
if: startsWith(github.ref, 'refs/tags/v')
4248
with:
4349
packages-dir: python/dist/
44-
45-
docs:
46-
runs-on: ubuntu-latest
47-
steps:
48-
- uses: actions/checkout@v4
49-
with:
50-
fetch-depth: 0
51-
fetch-tags: true
52-
53-
- name: Set up Python
54-
uses: actions/setup-python@v5
55-
with:
56-
python-version: '3.9'
57-
58-
- name: Install dependencies
59-
run: |
60-
python -m pip install --upgrade pip
61-
python -m pip install tox
62-
63-
- name: Build docs
64-
working-directory: ./python
65-
run: tox -e build-docs
66-
67-
- name: Upload artifacts
68-
uses: actions/upload-artifact@v4
69-
with:
70-
name: html-docs
71-
path: docs/_build/html/
72-
73-
- name: Deploy 🚀
74-
uses: peaceiris/actions-gh-pages@v3
75-
if: startsWith(github.ref, 'refs/tags/v')
76-
with:
77-
github_token: ${{ secrets.GITHUB_TOKEN }}
78-
publish_dir: docs/_build/html

.github/workflows/docs-release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: docs-release
2+
3+
on:
4+
push:
5+
branches: ['master']
6+
paths:
7+
- 'docs/**' # Trigger when files inside docs folder are changed
8+
pull_request:
9+
paths:
10+
- 'docs/**' # Trigger when docs are changed within a pull request
11+
workflow_dispatch: # Allow manual triggering of the workflow
12+
13+
14+
jobs:
15+
docs:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
fetch-tags: true
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.9'
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
python -m pip install tox
33+
34+
- name: Build docs
35+
working-directory: ./python
36+
run: tox -e build-docs
37+
38+
- name: Upload artifacts
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: html-docs
42+
path: docs/_build/html/
43+
44+
- name: Deploy 🚀
45+
uses: peaceiris/actions-gh-pages@v3
46+
# Deploy to the gh-pages branch when a tag is pushed or the workflow is manually triggered
47+
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
48+
with:
49+
github_token: ${{ secrets.GITHUB_TOKEN }}
50+
publish_dir: docs/_build/html

0 commit comments

Comments
 (0)