stages:
  - build
  - deploy

variables:
  GIT_DEPTH: "1"

get_lflist:
  stage: build
  script:
    - apt update;apt -y install wget sqlite3
    - wget -O lflist.conf https://code.mycard.moe/mycard/ygopro/-/raw/master/lflist.conf
    - ls locales | xargs -I {} bash -c 'cp ./lflist.conf ./locales/{}/ ; sqlite3 ./locales/{}/cards.cdb .dump > ./locales/{}/cards.sql'
    - cp -rf locales dist
  artifacts:
    paths:
      - dist/
  tags:
    - linux

upload_to_minio_latest:
  stage: deploy
  dependencies:
    - get_lflist
  tags: 
    - linux
  script:
    - aws s3 --endpoint=https://minio.mycard.moe:9000 sync --delete dist/ s3://mycard/ygopro-database
  only:
    - master

