stages:
  - test
  - build
  - deploy

lint:
  image: python:3.8
  stage: test

  cache:
    paths:
      - .cache/pre-commit

  except:
    - schedules

  variables:
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
    PRE_COMMIT_HOME: "$CI_PROJECT_DIR/.cache/pre-commit"

  before_script:
    - pip install pre-commit

  script:
    - pre-commit run -a

bump-python-deps:
  stage: deploy
  image: registry.gitlab.com/teklia/devops:latest

  only:
    - schedules

  script:
    - devops python-deps requirements.txt

release-notes:
  stage: deploy
  image: registry.gitlab.com/teklia/devops:latest

  rules:
    - if: '$CI_COMMIT_TAG'
      when: on_success
    - when: never

  script:
    - devops release-notes
