Repository navigation
1.0 documentation, README and release preparation #244
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Deploy | |
| # Two sites from one gh-pages branch: | |
| # | |
| # main -> https://www.the-ecg.org/Cardioception/ the released version | |
| # dev -> https://www.the-ecg.org/Cardioception/dev/ the development version | |
| # | |
| # Pull requests build but never deploy, so no PR can replace live documentation | |
| # before review. master holds 0.7.2 and no longer deploys: a push there would | |
| # replace the released 1.0 docs with 0.7 ones. | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| pull_request: | |
| branches: | |
| - main | |
| - dev | |
| permissions: | |
| contents: write | |
| # A push to main and a push to dev both write to gh-pages. Run deploys one at a | |
| # time so the second does not fail on a stale branch head; never cancel one | |
| # halfway through. | |
| concurrency: | |
| group: docs-deploy | |
| cancel-in-progress: false | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| env: | |
| # Read by conf.py: "dev" adds the development banner, marks every page | |
| # noindex and points canonical URLs at /dev/. | |
| DOCS_CHANNEL: ${{ (github.ref == 'refs/heads/dev' || github.base_ref == 'dev') && 'dev' || 'stable' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| cache: pip | |
| cache-dependency-path: requirements-docs.txt | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install --upgrade setuptools wheel | |
| pip install --no-deps -e . | |
| pip install -r requirements-docs.txt | |
| # -W turns warnings into errors, so a broken cross-reference or a missing | |
| # page fails the build instead of shipping. --keep-going reports all of | |
| # them in one run. | |
| - name: Build documentation | |
| run: | | |
| sphinx-build -W --keep-going -b html docs/source docs/build/html | |
| # The root deploy cleans out files the new build no longer has, which | |
| # would include the whole dev/ folder. clean-exclude keeps it, and the | |
| # CNAME that serves the site at www.the-ecg.org. | |
| - name: Deploy the released docs | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| folder: docs/build/html | |
| branch: gh-pages | |
| clean-exclude: | | |
| dev | |
| CNAME | |
| - name: Deploy the development docs | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/dev' | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| folder: docs/build/html | |
| branch: gh-pages | |
| target-folder: dev |