Skip to content
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

[GH] Decouple distribution and docs release workflows #412

Merged
merged 10 commits into from
Oct 2, 2024
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
name: build-release
name: dist-release

on:
pull_request:
types: [opened, synchronize]
paths-ignore:
- 'docs/**' # Ignore changes in the docs folder for pull requests
- '.github' # Ignore changes in the .github folder for pull requests
push:
branches: ['master']
paths-ignore:
- 'docs/**' # Ignore changes in the docs folder for pushes
- '.github' # Ignore changes in the .github folder for pushes

jobs:
release:
Expand Down Expand Up @@ -41,38 +47,3 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
with:
packages-dir: python/dist/

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox

- name: Build docs
working-directory: ./python
run: tox -e build-docs

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: html-docs
path: docs/_build/html/

- name: Deploy 🚀
uses: peaceiris/actions-gh-pages@v3
if: startsWith(github.ref, 'refs/tags/v')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
50 changes: 50 additions & 0 deletions .github/workflows/docs-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: docs-release

on:
push:
branches: ['master']
paths:
- 'docs/**' # Trigger when files inside docs folder are changed
pull_request:
paths:
- 'docs/**' # Trigger when docs are changed within a pull request
workflow_dispatch: # Allow manual triggering of the workflow


jobs:
docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox

- name: Build docs
working-directory: ./python
run: tox -e build-docs

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: html-docs
path: docs/_build/html/

- name: Deploy 🚀
uses: peaceiris/actions-gh-pages@v3
# Deploy to the gh-pages branch when a tag is pushed or the workflow is manually triggered
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html