diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 5c5abb7..526d0ac 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -26,7 +26,7 @@ jobs: tagging_message: "v${{ steps.update_data.outputs.version }}" - name: Create Release run: | - pip install -r requirements.txt + pip install -r src/requirements.txt make release "version=v${{ steps.update_data.outputs.version }}" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index bd9fd53..4322cbb 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,21 @@ SHELL=/bin/bash version=`date +%Y.%-m.%-d` -# Build Process +.SILENT: +check: + for cmd in pup jq parallel curl sed;do \ + command -v $$cmd >/dev/null 2>&1 || { echo >&2 "I require $$cmd but it's not installed. Aborting."; exit 1; }; \ + done + +# Build Process ISIN: INE INF IN9 IN0 IN1 IN2 IN3 IN4 cat header.csv IN*.csv > ISIN.csv rm IN*.csv INE INF IN9 IN0 IN1 IN2 IN3 IN4: - ./fetch.sh $@ + ./src/fetch.sh $@ + update: ISIN echo "::set-output name=version::$(version)" sed -i "s/^version.*/version: $(version)/" CITATION.cff @@ -24,7 +31,7 @@ old: git show HEAD^:ISIN.csv > /tmp/ISIN.csv release.md: old - python3 diff.py > release.md + python3 src/diff.py > release.md release: release.md gh release create "$(version)" --notes-file release.md ISIN.csv diff --git a/README.md b/README.md index a1bef88..13ea067 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,15 @@ ISIN|Payload|Check Digit|Validate # Code -You can run the `fetch.sh` script to generate the tracked the files from scratch. Dependencies: +You can run the following to generate the `ISIN.csv` file from scratch: + +``` +git clone https://github.com/captn3m0/india-isin-data.git +make check +make ISIN +``` + +## Dependencies: - https://github.com/ericchiang/pup - https://stedolan.github.io/jq/ diff --git a/diff.py b/src/diff.py similarity index 85% rename from diff.py rename to src/diff.py index 935faa6..059080a 100644 --- a/diff.py +++ b/src/diff.py @@ -2,7 +2,7 @@ from csv_diff import load_csv, compare import json from mako.template import Template -template = Template(filename='release.mako') +template = Template(filename='src/release.mako') added,removed,changed = [],[],[] diff --git a/fetch.sh b/src/fetch.sh similarity index 100% rename from fetch.sh rename to src/fetch.sh diff --git a/header.csv b/src/header.csv similarity index 100% rename from header.csv rename to src/header.csv diff --git a/release.mako b/src/release.mako similarity index 100% rename from release.mako rename to src/release.mako diff --git a/requirements.txt b/src/requirements.txt similarity index 100% rename from requirements.txt rename to src/requirements.txt