---
kind: pipeline
name: backend
type: docker

steps:
  - name: deploy web
    image: node:alpine
    environment:
      NETLIFY_AUTH_TOKEN:
        from_secret: NETLIFY_TOKEN
      NETLIFY_SITE_ID: 753cd3b7-e235-439a-a7a0-6aee33e0c445
      NPM_TOKEN:
        from_secret: NPM_TOKEN
      NPM_UNOM_TOKEN:
        from_secret: UNOM_PKG_TOKEN
    commands:
      - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
      - echo "//packages.unom.io/:_authToken=$NPM_UNOM_TOKEN" >> .npmrc
      - echo "registry=https://registry.npmjs.org" >> .npmrc
      - echo "@tempblade:registry=https://packages.unom.io" >> .npmrc
      - echo "@unom:registry=https://packages.unom.io" >> .npmrc
      - yarn install
      - yarn build
      - yarn netlify deploy --dir=dist --prod
