stages:
  - build
  - deploy

variables:
  GIT_DEPTH: "1"

build:
  stage: build
  tags: 
    - linux
  script:
    - npm ci
    - npm run build
  artifacts:
    paths:
      - dist/

upload_to_minio:
  stage: deploy
  dependencies:
    - build
  tags:
    - linux
  script:
    - aws s3 --endpoint=https://minio.mycard.moe:9000 sync --delete dist/full/ s3://nanahira/koishi-plugin/hisoutensoku-jammer
  only:
    - master

deploy_npm:
  stage: deploy
  dependencies:
    - build
  tags:
    - linux
  script:
    - apt update;apt -y install coreutils
    - echo $NPMRC | base64 --decode > ~/.npmrc
    - npm publish . || true
  only:
    - master
