Skip to content

Commit

Permalink
Optimize workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Warner <[email protected]>
  • Loading branch information
brianwarner committed Nov 24, 2024
1 parent bfa8699 commit 6a7225d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 27 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: |
pytest
build:
name: Build and generate documentation
name: Regenerate documentation
needs: test
runs-on: ubuntu-latest
permissions:
Expand All @@ -47,20 +47,14 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-dev.txt
- name: Build the packages
run: |
python -m build
python -m pip install -r sphinx sphinx_rtd_theme myst_parser
- name: Generate documentation
run: |
sphinx-build -b html docsrc docs -E -d "docsrc/_doctrees"
- name: Generate documentation with latest version
run: |
sphinx-build -b html docsrc docs -E -d "docsrc/_doctrees"
- name: Check if there are any changes
id: verify_diff
run: |
Expand Down
21 changes: 3 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test, build, generate docs, and publish to PyPI
name: Test and publish to PyPI

on:
push:
Expand Down Expand Up @@ -33,7 +33,7 @@ jobs:
run: |
pytest
pypi-publish:
name: Upload release to PyPI and update documentation
name: Upload release to PyPI
needs: test
runs-on: ubuntu-latest
permissions:
Expand All @@ -43,7 +43,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -53,18 +53,3 @@ jobs:
python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Generate documentation with latest version
run: |
sphinx-build -b html docsrc docs -E -d "docsrc/_doctrees"
- name: Check if there are any changes
id: verify_diff
run: |
git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit and push the new documentation
if: steps.verify_diff.outputs.changed == 'true'
run: |
git config user.name "Brian Warner"
git config user.email [email protected]
git add docs
git commit -m "Rebuild the documentation" || exit 0
git push

0 comments on commit 6a7225d

Please sign in to comment.