-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (48 loc) · 2.06 KB
/
report-erd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Generate database documentation of report database
on:
push:
tags:
- '*.rc*'
paths:
- 'services/report/prisma/schema.prisma'
workflow_dispatch:
env:
PRISMA_SCHEMA: services/report/prisma/schema.prisma
OUT_ERD_PATH: services/report/prisma/doc/ERD.svg
OUT_DIC_PATH: services/report/prisma/doc/DIC.md
DIC_NAME: ezREEPORT
COMMIT_NAME: 'docs(report): updated database documentation[skip ci]'
COMMIT_BODY: '${{ github.event.compare }}'
COMMIT_FOOTER: 'Co-authored-by: @${{ github.event.sender.login }}'
ERD_WS: https://p-erd.oxypomme.fr/
ERD_WS_KEY: ${{ secrets.PRISMA_ERD_API_KEY }}
jobs:
generate-db-doc:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Generate ERD 🔧
run: 'curl -X POST -d "$(cat ${{ env.PRISMA_SCHEMA }})" -H "Content-Type: text/plain" -H "X-Api-Key: ${{ env.ERD_WS_KEY }}" -o "${{ env.OUT_ERD_PATH }}" ${{ env.ERD_WS }}/erd/'
- name: Generate Data dictionary 🔧
run: 'curl -X POST -d "$(cat ${{ env.PRISMA_SCHEMA }})" -H "Content-Type: text/plain" -H "X-Api-Key: ${{ env.ERD_WS_KEY }}" -o "${{ env.OUT_DIC_PATH }}" ${{ env.ERD_WS }}/dict/\?name\=${{ env.DIC_NAME }}'
- name: Setup pnpm ⚙️
uses: pnpm/action-setup@v3
- name: Setup Node ⚙️
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'pnpm'
- name: Install dependencies ⚙️
run: pnpm install --frozen-lockfile
- name: Commit files 🚀
run: |
HUSKY=0
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "${{ env.COMMIT_NAME }}" -m "${{ env.COMMIT_BODY }}" -m "${{ env.COMMIT_FOOTER }}"
remote_repo="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
git push ${remote_repo} HEAD:${{ github.ref }} --follow-tags