Add mkdocs documentation build to playground deployment workflow#39
Conversation
Co-authored-by: Sander-Toonen <5106372+Sander-Toonen@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR extends the playground deployment workflow to build and deploy mkdocs documentation alongside the playground application.
Changes:
- Adds Python environment setup and mkdocs-material installation to the GitHub Actions workflow
- Integrates mkdocs documentation build step into the existing playground deployment process
- Configures deployment structure to serve playground at root (/) and documentation at /docs/
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| - name: Install mkdocs | ||
| run: pip install mkdocs-material==9.7.1 | ||
|
|
There was a problem hiding this comment.
The documentation is being deployed to '/docs/' subdirectory, but the mkdocs.yml configuration has 'site_url: https://pro-fa.github.io/expr-eval/' (without '/docs/'). This mismatch may cause issues with internal links, asset paths, and sitemap generation in the built documentation. Consider either updating mkdocs.yml to set 'site_url: https://pro-fa.github.io/expr-eval/docs/' or using the 'use_directory_urls: false' option, or alternatively modifying this workflow step to update the site_url before building with a command like 'sed -i "s|site_url:.*|site_url: https://pro-fa.github.io/expr-eval/docs/|" mkdocs.yml' before running 'mkdocs build'.
| - name: Update mkdocs site_url for /docs/ deployment | |
| run: sed -i 's|^site_url:.*|site_url: https://pro-fa.github.io/expr-eval/docs/|' mkdocs.yml |
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.x' |
There was a problem hiding this comment.
Consider adding pip caching to improve build performance, similar to how npm is cached for Node.js. The setup-python action supports caching pip dependencies by adding a 'cache' parameter. This would speed up subsequent workflow runs by avoiding re-downloading mkdocs-material and its dependencies each time.
| python-version: '3.x' | |
| python-version: '3.x' | |
| cache: 'pip' |
| cp samples/language-service-sample/examples.js _site/ | ||
| cp samples/language-service-sample/styles.css _site/ | ||
| cp dist/bundle.js _site/dist/ | ||
| cp -r site _site/docs |
There was a problem hiding this comment.
The 'site' directory is being copied without first verifying that the mkdocs build step successfully created it. If 'mkdocs build' fails or doesn't produce output, the copy command will fail with a potentially unclear error message. Consider adding a verification step or using a more defensive copy command like 'cp -r site _site/docs || echo "Warning: mkdocs site directory not found"' to make troubleshooting easier. Alternatively, ensure the mkdocs build command will fail the workflow if it encounters an error.
| cp -r site _site/docs | |
| if [ -d site ]; then | |
| cp -r site _site/docs | |
| else | |
| echo "Warning: mkdocs 'site' directory not found; skipping docs copy" | |
| fi |
Extends the
deploy-playground.ymlworkflow to build and deploy mkdocs documentation alongside the playground at/docs/.Changes
actions/setup-python@v5for mkdocs runtimemkdocs-material==9.7.1(pinned) and runmkdocs buildsite/directory to_site/docs/before uploadAfter deployment:
//docs/Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.