From de20da4321f8dc45f9834f260954fcd0374d99f3 Mon Sep 17 00:00:00 2001 From: Keitaroh Kobayashi Date: Thu, 26 Sep 2024 16:24:34 +0900 Subject: [PATCH] Create data --- .github/workflows/create-data.yml | 40 +++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/create-data.yml diff --git a/.github/workflows/create-data.yml b/.github/workflows/create-data.yml new file mode 100644 index 0000000..7050d03 --- /dev/null +++ b/.github/workflows/create-data.yml @@ -0,0 +1,40 @@ +name: Create Data + +on: + # TODO: Run this workflow every month + # schedule: + # - cron: '0 0 * * *' + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + + - name: Cache + uses: actions/cache@v4 + with: + key: 'v1' + path: cache + + - name: Install dependencies + run: npm ci + + - name: Create all data + run: npm run run:all + + - name: Deploy to R2 + env: + AWS_ACCESS_KEY_ID: ${{ vars.R2_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} + R2_ENDPOINT: ${{ vars.R2_ENDPOINT }} + run: | + aws s3 sync --region="auto" --endpoint="$R2_ENDPOINT" ./out/ s3://japanese-addresses-v2/ diff --git a/package.json b/package.json index c29ef9a..ee68842 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "build:proto": "protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=. ./src/address_data.proto", "build": "tsc", "clear:cache": "shx rm -rf ./cache", - "run": "npm run run:01_make_prefecture_city && npm run run:02_make_machi_aza && npm run run:03_make_rsdt && npm run run:04_make_chiban", + "run:all": "npm run run:01_make_prefecture_city && npm run run:02_make_machi_aza && npm run run:03_make_rsdt && npm run run:04_make_chiban", "run:01_make_prefecture_city": "tsx ./src/01_make_prefecture_city.ts", "run:02_make_machi_aza": "tsx ./src/02_make_machi_aza.ts", "run:03_make_rsdt": "tsx ./src/03_make_rsdt.ts",