image: node:buster

variables:
  SITE_NAME: cf2021.pirati.cz
  ARTIFACTS_PATH: build
  REACT_APP_API_BASE_URL: /api
  WEBHOOK_URL: https://ha-web.pirati.cz

before_script:
  - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq curl

build:
  stage: build
  script:
    - npm install
    - npm run build
  after_script:
    - echo "{\"job_token\":\"$CI_JOB_TOKEN\", \"name\":\"$SITE_NAME\" }" > request.json
    - "curl -H 'Content-Type: application/json' -X POST -d @request.json $WEBHOOK_URL"
  artifacts:
    expire_in: 30 min
    paths:
     - $ARTIFACTS_PATH

