Build MKDocs #218
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
| # (c) https://github.com/MontiCore/monticore | |
| name: Build MKDocs | |
| on: | |
| push: # run this test pipeline on every push (if markdown and/or the docs directory was changed) | |
| paths: | |
| - "**.md" | |
| - "docs/**" | |
| pull_request: # and pull request (Note: We can skip pull request events IFF the PR is not done from a fork) | |
| paths: | |
| - "**.md" | |
| - "docs/**" | |
| workflow_run: # and when the javadocs have been updated | |
| workflows: [ "Gradle Deploy Snapshot" ] | |
| types: | |
| - completed | |
| permissions: | |
| contents: read # This action may run somewhat unsafe code | |
| jobs: | |
| build_pages: | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/dev' | |
| steps: | |
| - name: Checkout project sources | |
| uses: actions/checkout@v4 | |
| - name: Download Javadoc artifact | |
| uses: dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 | |
| continue-on-error: true # the javadocs are sometimes not present (e.g., when the artifact is expired) | |
| with: | |
| workflow: deploy_snapshot_mc.yml | |
| workflow_conclusion: success | |
| branch: dev | |
| name: javadoc | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install python packages | |
| env: | |
| GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install mkdocs mkdocs-material | |
| git clone https://monticore:[email protected]/se/infrastructure/monticore-pygments-highlighting.git | |
| pip install -r ./monticore-pygments-highlighting/requirements.txt | |
| pip install ./monticore-pygments-highlighting | |
| - name: Preprocess the docs | |
| run: sh docs/scripts/preprocessing.sh inplace | |
| - name: Build the docs into a site directory | |
| run: mkdocs build --verbose --clean --strict | |
| - name: Upload static files as artifact | |
| id: deployment | |
| uses: actions/upload-pages-artifact@v3 # or specific "vX.X.X" version tag for this action | |
| with: | |
| path: site/ | |
| deploy: | |
| # Deploy to the github-pages environment | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/dev' # only for the dev branch! | |
| needs: build_pages | |
| # Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
| permissions: | |
| pages: write # to deploy to Pages | |
| id-token: write # to verify the deployment originates from an appropriate source | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |