Documentation #1
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: | |
| pull_request: | |
| paths: | |
| - '*.md' | |
| - 'docs/**' | |
| - 'packages/**/*.md' | |
| - 'latest.json' | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '*.md' | |
| - 'docs/**' | |
| - 'packages/**/*.md' | |
| - 'latest.json' | |
| permissions: {} | |
| jobs: | |
| docs: | |
| name: Build & Verify Docs | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --immutable | |
| - name: Lint docs | |
| run: yarn run prettier:checkDocs | |
| env: | |
| # Increase memory for prettier due to large number of files | |
| NODE_OPTIONS: --max_old_space_size=8192 | |
| - name: Build docs website | |
| run: | | |
| # Create and start a container from the docs-base image in detached mode | |
| docker run -d --name docs-builder grafana/docs-base:latest tail -f /dev/null | |
| # Create the directory structure inside the container | |
| docker exec docs-builder mkdir -p /hugo/content/docs/grafana/latest | |
| # Create the _index.md file | |
| docker exec docs-builder /bin/sh -c "echo -e '---\nredirectURL: /docs/grafana/latest/\ntype: redirect\nversioned: true\n---\n' > /hugo/content/docs/grafana/_index.md" | |
| # Copy the docs sources from the host to the container | |
| docker cp docs/sources/. docs-builder:/hugo/content/docs/grafana/latest/ | |
| # Run the make prod command inside the container | |
| docker exec -w /hugo docs-builder make prod || echo "Build completed with warnings" | |
| # Clean up the container | |
| docker rm -f docs-builder |