stages:
  - install
  - lint
  - test
  - build
  - deploy

npm_ci:
  stage: install
  tags:
    - linux
  script: npm ci
  artifacts:
    paths:
      - node_modules

.build_base:
  tags:
    - linux
  dependencies:
    - npm_ci

npm_lint:
  extends: .build_base
  stage: lint
  tags:
    - linux
  script: npm run lint

npm_build:
  extends: .build_base
  stage: build
  tags:
    - linux
  script:
    - mv neos.config.prod.json neos.config.json
    - npm run build:prod
  artifacts:
    paths:
      - dist

deploy:
  stage: deploy
  tags:
    - linux
  only:
    - main
  dependencies: 
    - npm_build
  script:
    - mv neos-assets dist/
    - aws s3 --endpoint=https://minio.mycard.moe:9000 sync --delete dist/ s3://mycard/neos
