From ac0d44d4c98f10048621498d9eb1670ad632bf9e Mon Sep 17 00:00:00 2001 From: creme332 <65414576+creme332@users.noreply.github.com> Date: Mon, 20 May 2024 21:06:29 +0400 Subject: [PATCH] add new workflow to generate schema website --- .github/workflows/db.yml | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/db.yml diff --git a/.github/workflows/db.yml b/.github/workflows/db.yml new file mode 100644 index 00000000..1104ba38 --- /dev/null +++ b/.github/workflows/db.yml @@ -0,0 +1,51 @@ +name: Generate schema + +on: + push: + paths: + - resources/database/** + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + env: + DB_USER: root # do not change + DB_PASSWORD: root # do not change + + steps: + - uses: actions/checkout@v4 + + - name: Setup database + run: | + mysql -V + sudo /etc/init.d/mysql start + mysql -u$DB_USER -p$DB_PASSWORD -hlocalhost -P3306 < "resources/database/cafe_schema.sql" + mysql -e "USE cafe; SHOW TABLES;" -u$DB_USER -p$DB_PASSWORD + + - name: Install spyschema dependencies + run: | + wget https://github.com/schemaspy/schemaspy/releases/download/v6.2.4/schemaspy-6.2.4.jar + wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-j-8.4.0.tar.gz + tar -xvzf mysql-connector-j-8.4.0.tar.gz + sudo apt install graphviz + + - name: Generate schema spy website + run: | + java -jar schemaspy-6.2.4.jar \ + -t mysql \ + -dp mysql-connector-j-8.4.0/mysql-connector-j-8.4.0.jar \ + -db cafe \ + -host localhost \ + -u $DB_USER \ + -p $DB_PASSWORD \ + -o dist \ + -s cafe + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist \ No newline at end of file