Add highlighting support to code blocks (#1654) #1185
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: Generate db docs | |
| permissions: read-all | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths-ignore: | |
| - "docs/**" | |
| - "services/cms/**" | |
| - "services/example-exercise/**" | |
| - "services/main-frontend/**" | |
| - "services/quizzes/**" | |
| - "services/tmc/**" | |
| - "storybook/**" | |
| - "system-tests/**" | |
| jobs: | |
| generate-db-docs: | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-24.04 | |
| container: eu.gcr.io/moocfi-public/db-docs | |
| services: | |
| postgres: | |
| image: postgres | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Check out this repo | |
| uses: actions/checkout@v5 | |
| - name: Check out docs repo (with an SSH deploy key) | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: rage/secret-project-331-db-docs | |
| path: db-docs | |
| fetch-depth: 0 | |
| ssh-key: ${{ secrets.DB_DOCS_DEPLOY_KEY }} | |
| - name: Setup database | |
| run: sqlx database setup | |
| working-directory: ./services/headless-lms | |
| env: | |
| DATABASE_URL: postgres://postgres:postgres@postgres/headless_lms_dev | |
| - name: Generate tbls docs | |
| run: tbls doc 'postgres://postgres:postgres@postgres/headless_lms_dev?sslmode=disable' db-docs --force --sort | |
| # Column comments can be quite long and they are a bit too much text for the whole | |
| # entity relationship diagram so we'll remove them from the diagram. | |
| # Note that the column comments are still visible from the markdown documentation. | |
| - name: Remove all column comments | |
| run: psql 'postgres://postgres:postgres@postgres/headless_lms_dev?sslmode=disable' -c 'DELETE FROM pg_description WHERE objsubid > 0;' | |
| - name: Generate UML with planter | |
| run: planter 'postgres://postgres:postgres@postgres/headless_lms_dev?sslmode=disable' -o db-docs/schema.uml | |
| - name: Patch UML for wide comments | |
| run: sed -i 's/skinparam linetype ortho/skinparam linetype ortho\nskinparam wrapWidth 300/' db-docs/schema.uml | |
| - name: Generate PlantUML SVG | |
| run: plantuml -tsvg schema.uml | |
| working-directory: ./db-docs | |
| - name: Generate HTML with Pandoc | |
| run: | | |
| for f in *.md; do | |
| f2=${f%.md} | |
| pandoc -f markdown -t html5 "$f" -o "$f2.html" \ | |
| --lua-filter=../misc/db-docs/pandoc-links-md-extension-to-html-extension.lua \ | |
| --template ../misc/db-docs/template.html | |
| cp README.html index.html | |
| done | |
| working-directory: ./db-docs | |
| - name: Commit files | |
| run: | | |
| git config --local user.email "bot@example.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add . | |
| git commit -m "Update: $GITHUB_SHA" --allow-empty | |
| working-directory: ./db-docs | |
| - name: Push changes | |
| run: git push | |
| working-directory: ./db-docs |