image: "registry.gitlab.com/smc/dockerfiles:font-builder"

stages:
  - build
  - test
  - release

build-branch:
  stage: build
  before_script:
    - apt-get update -y
    - apt-get install -y make python3-pip
    - pip3 install -r requirements.txt
  script:
    - make otf ttf webfonts
  artifacts:
    paths:
    - build/
  except:
    - tags

build-tag:
  stage: build
  before_script:
    - apt-get update -y
    - apt-get install -y make python3-pip zip
    - pip3 install -r requirements.txt
  script:
    - make ttf otf webfonts
    - sh tools/artifacts.sh
  artifacts:
    expire_in: 1000 yrs
    paths:
    - build/
  only:
    - tags

test:
  stage: test
  before_script:
    - apt-get update -y
    - apt-get install -y make libharfbuzz-bin python3-pip
    - pip3 install -r requirements.txt
  script:
    - make test

create-gitlab-release:
  image: "ruby:2.6-alpine"
  stage: release
  script:
    - gem install --no-document gitlab
    - ruby release.rb
  only:
    - tags

release:
  stage: release
  trigger: smc/smc.org.in
  only:
    - tags
