Skip to content

Create Data

Create Data #6

Workflow file for this run

name: Create Data
on:
# TODO: Run this workflow every month
# schedule:
# - cron: '0 0 * * *'
workflow_dispatch:
jobs:
create-data:
runs-on: ubuntu-latest
# id-token: write is required for AWS authentication
permissions:
id-token: write
contents: read
steps:
- name: Remove unused software
run: |
echo "Available storage before:"
sudo df -h
echo
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
echo "Available storage after:"
sudo df -h
echo
- 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
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.AWS_ROLE_ARN }}
aws-region: ap-northeast-1
- name: Deploy to AWS
run: |
./deploy/01_sync_to_s3.sh
- name: Create archive
run: |
./deploy/01a_create_archive.sh
- name: Upload archive to S3
run: |
aws s3 cp \
./out/api.tar.zst s3://japanese-addresses-v2.geoloniamaps.com/experimental/api.tar.zst
clear-cdn-cache:
needs:
- create-data
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Clear Cloudflare cache
env:
CLOUDFLARE_ZONE_ID: ${{ vars.CLOUDFLARE_ZONE_ID }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_PURGE_TOKEN }}
run: |
./deploy/02_clear_cloudflare_cache.sh