Skip to content

Commit

Permalink
[GH] Decouple distribution and docs release workflows (#412)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
R7L208 authored Oct 2, 2024
1 parent 514aeb6 commit 2f3c29b
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 36 deletions.
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

0 comments on commit 2f3c29b

Please sign in to comment.