image: node:16.20

variables:
  SITE_NAME: kalkulacka.pirati.cz
  ARTIFACTS_PATH: dist
  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 generate
  after_script:
    - echo "{\"name\":\"$SITE_NAME\" }" > request.json
    - "curl -k -H 'Content-Type: application/json' -X POST -d @request.json $WEBHOOK_URL"
  artifacts:
    expire_in: 30 min
    paths:
     - $ARTIFACTS_PATH

