|
| 1 | +name: generate-docs |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + # Standard drop-in approach that should work for most people. |
| 16 | + - uses: ammaraskar/sphinx-action@master |
| 17 | + with: |
| 18 | + pre-build-command: "make clean" |
| 19 | + build-command: "make html" |
| 20 | + docs-folder: "docs/" |
| 21 | + # Example of using a custom build-command. |
| 22 | +# - uses: ammaraskar/sphinx-action@master |
| 23 | +# with: |
| 24 | +# build-command: "sphinx-build -b html . _build" |
| 25 | +# docs-folder: "docs2/" |
| 26 | + # Grabbing custom dependencies and building as a pdf. |
| 27 | +# - uses: ammaraskar/sphinx-action@master |
| 28 | +# with: |
| 29 | +# pre-build-command: "apt-get update -y && apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended" |
| 30 | +# build-command: "make latexpdf" |
| 31 | +# docs-folder: "docs2/" |
| 32 | + # Great extra actions to compose with: |
| 33 | + # Create an artifact of the html output. |
| 34 | +# - uses: actions/upload-artifact@v1 |
| 35 | +# with: |
| 36 | +# name: DocumentationHTML |
| 37 | +# path: docs/_build/html/ |
| 38 | + # Create an artifact out of the previously built pdf. |
| 39 | +# - uses: actions/upload-artifact@v1 |
| 40 | +# with: |
| 41 | +# name: Documentation |
| 42 | +# path: docs2/_build/latex/pdfexample.pdf |
| 43 | + # Publish built docs to gh-pages branch. |
| 44 | + # =============================== |
| 45 | + - name: Commit documentation changes |
| 46 | + run: | |
| 47 | + git clone https://github.com/matteemol/dbSketcher.git --branch main --single-branch main |
| 48 | + cp -r docs/build/html/* built-docs/ |
| 49 | + cd gh-pages |
| 50 | +# touch .nojekyll |
| 51 | + git config --local user.email "action@github.com" |
| 52 | + git config --local user.name "GitHub Action" |
| 53 | + git add . |
| 54 | + git commit -m "Update documentation" -a || true |
| 55 | + # The above command will fail if no changes were present, so we ignore |
| 56 | + # that. |
| 57 | + - name: Push changes |
| 58 | + uses: ad-m/github-push-action@master |
| 59 | + with: |
| 60 | + branch: main |
| 61 | + directory: built-docs |
| 62 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + # =============================== |
0 commit comments