Skip to content

Option to use Azure search with the chatbot (#1330) #916

Option to use Azure search with the chatbot (#1330)

Option to use Azure search with the chatbot (#1330) #916

name: Generate db docs
on:
push:
branches:
- master
jobs:
generate-db-docs:
runs-on: ubuntu-latest
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 repository code
uses: actions/checkout@v4
- name: Set up deploy key
run: |
mkdir -p ~/.ssh
echo "$DB_DOCS_DEPLOY_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
md5sum ~/.ssh/id_ed25519
ls -la ~/.ssh
env:
DB_DOCS_DEPLOY_KEY: ${{ secrets.DB_DOCS_DEPLOY_KEY }}
- name: Check out docs repo
run: git clone [email protected]:rage/secret-project-331-db-docs.git db-docs
env:
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_ed25519 -o IdentitiesOnly=yes"
- 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 to work with 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
# remove .md extension
f2=${f%.md}
# convert to html
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 "[email protected]"
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
env:
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_ed25519 -o IdentitiesOnly=yes"
working-directory: ./db-docs