Documentation #54
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: Documentation | |
| on: | |
| push: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| jobs: | |
| changed: | |
| uses: ./.github/workflows/changed.yml | |
| java: | |
| needs: changed | |
| if: ${{ needs.changed.outputs.java == 'true' || needs.changed.outputs.actions == 'true' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'oracle' | |
| - name: Remove old content | |
| run: rm -rf ./site/java | |
| - name: Build site | |
| run: mvn site | |
| working-directory: ./java | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: java | |
| path: ./java/target/site | |
| python: | |
| needs: changed | |
| if: ${{ needs.changed.outputs.python == 'true' || needs.changed.outputs.actions == 'true' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dev dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| working-directory: ./python | |
| - name: Build site | |
| run: pdoc --html weftspace | |
| working-directory: ./python | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python | |
| path: ./python/html | |
| - name: Build tests | |
| run: pdoc -o htmltests/ --html tests | |
| working-directory: ./python | |
| - name: Upload test artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-tests | |
| path: ./python/htmltests | |
| # I'm sure there's a better way to handle this, but this should work to | |
| # prevent merge conflicts and reduce commit count so I'm just going to | |
| # use it. Feel free to improve it if you want. | |
| commit-all: | |
| needs: [java, python] | |
| if: | | |
| always() && | |
| needs.java.result == 'success' && | |
| needs.python.result == 'success' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Remove old content | |
| run: | | |
| rm -rf ./site/java | |
| rm -rf ./site/python | |
| mkdir ./site/python | |
| - name: Download Java site | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: java | |
| path: ./site/java | |
| - name: Download Python site | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python | |
| path: ./site/python | |
| - name: Download Python test site | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-tests | |
| path: ./site/python | |
| - name: Commit changes | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| message: 'chore: Update site (Java, Python)' | |
| default_author: github_actions | |
| add: ./site/**/* | |
| commit-java: | |
| needs: [java, python] | |
| if: | | |
| always() && | |
| needs.java.result == 'success' && | |
| needs.python.result == 'skipped' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Remove old content | |
| run: | | |
| rm -rf ./site/java | |
| - name: Download Java site | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: java | |
| path: ./site/java | |
| - name: Commit changes | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| message: 'chore: Update site (Java, Python)' | |
| default_author: github_actions | |
| add: ./site/**/* | |
| commit-python: | |
| needs: [java, python] | |
| if: | | |
| always() && | |
| needs.java.result == 'skipped' && | |
| needs.python.result == 'success' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Remove old content | |
| run: | | |
| rm -rf ./site/python | |
| mkdir ./site/python | |
| - name: Download Python site | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python | |
| path: ./site/python | |
| - name: Download Python test site | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-tests | |
| path: ./site/python | |
| - name: Commit changes | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| message: 'chore: Update site (Java, Python)' | |
| default_author: github_actions | |
| add: ./site/**/* |