diff --git a/.github/workflows/build-release.yml b/.github/workflows/dist-releasae.yml similarity index 54% rename from .github/workflows/build-release.yml rename to .github/workflows/dist-releasae.yml index 877ecfd7..907227aa 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/dist-releasae.yml @@ -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: @@ -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 diff --git a/.github/workflows/docs-release.yml b/.github/workflows/docs-release.yml new file mode 100644 index 00000000..35c45dba --- /dev/null +++ b/.github/workflows/docs-release.yml @@ -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