stages:
  - test
  - deploy

build:
  stage: test
  image: node:lts-alpine
  script:
    - npm i
    - npm run build
  artifacts:
    paths:
      - dist/*

deploy:
  stage: deploy
  image: node:lts-alpine
  script:
    - npm config set @${CI_PROJECT_NAMESPACE}:registry ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/npm/
    - npm config set -- '//git.computational.bio.uni-giessen.de/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken' "$CI_JOB_TOKEN"
    - npm publish
  only:
    - tags
