From 9f4d87237ca877115e72aea34642e34a7b15b2d0 Mon Sep 17 00:00:00 2001 From: blasferna Date: Mon, 12 Dec 2022 14:34:30 -0300 Subject: [PATCH] Upload ruc.db to a file server --- .github/workflows/build.yml | 5 +++++ .github/workflows/publish.yml | 3 +++ data/download.py | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 78d7d04..5531614 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,6 +29,11 @@ jobs: run: | cd data && python download.py + - name: Upload ruc + run: | + cd data && curl -T ruc.db ${{ secrets.RUC_DB_URL }} -u "${{secrets.RUC_USER}}:${{secrets.RUC_PASSWORD}}" + + - name: Commit changes uses: EndBug/add-and-commit@v7 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e10feea..0e18a5b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -29,6 +29,9 @@ jobs: - name: Download people database run: wget ${{ secrets.PEOPLE_DB_URL }} -P data/ + - name: Download ruc database + run: wget --user ${{ secrets.RUC_USER }} --password ${{ secrets.RUC_PASSWORD }} ${{ secrets.RUC_DB_URL }} -P data/ + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v3 diff --git a/data/download.py b/data/download.py index 3137817..cbb05ad 100644 --- a/data/download.py +++ b/data/download.py @@ -172,7 +172,7 @@ def build_database(): def build_sqlite3(): con = sqlite3.connect("ruc.db") cur = con.cursor() - cur.execute("DROP TABLE ruc") + cur.execute("DROP TABLE IF EXISTS ruc") cur.execute( """CREATE TABLE ruc (ruc text, razonsocial text, tipo text, categoria text, dv text, estado text)"""