Merge pull request #30 from gsainfoteam/update-dbml #1
This file contains 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: update erd | |
on: | |
push: | |
paths: | |
- 'prisma/schema.prisma' | |
branches: | |
- main | |
jobs: | |
build: | |
name: Generate and Build ERD | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
with: | |
ssh-key: ${{ secrets.DBDOCS_COMMIT_KEY }} | |
- name: Install prisma-dbml-generator and dbdocs | |
run: sudo npm install -g prisma-dbml-generator dbdocs | |
- name: Check dbdocs | |
run: dbdocs --version | |
- name: Generate dbml | |
run: npx prisma generate | |
- name: Build and Update ERD | |
run: dbdocs build ./prisma/dbml/schema.dbml | |
env: | |
DBDOCS_TOKEN: ${{ secrets.DBDOCS_TOKEN }} | |
- name: Check if there are any changes | |
id: check_changes | |
run: | | |
git diff --quiet . || echo "changed=true" >> "$GITHUB_OUTPUT" | |
- name: Commit and Push | |
if: steps.check_changes.outputs.changed == 'true' | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "GitHub Actions [bot]" | |
git commit -am "Update dbml" | |
git push -u origin main |