sudo: false
language: python
python: 3.6

cache: pip

before_install: pip install flit
# Use `--deps production` so that we don't install unnecessary dependencies
install: flit install --deps production --extras test
script: pytest -m offline

jobs:
  include:
  - python: 2.7
    before_install:
    - sudo apt-get -y install python3-pip python3-setuptools
    - sudo pip3 install flit
    install: flit install --python python --deps production --extras test
  - python: 3.4
  - python: 3.5
  - python: 3.6
  - python: 3.7
    dist: xenial
    sudo: required
  - python: pypy3.5

  - name: Lint
    before_install: skip
    install: pip install black
    script: black --check --verbose .

  - stage: deploy
    name: Github Releases
    if: tag IS present
    install: skip
    script: flit build
    deploy:
      provider: releases
      api_key: $GITHUB_OAUTH_TOKEN
      file_glob: true
      file: dist/*
      skip_cleanup: true
      draft: true
      on:
        tags: true

  - stage: deploy
    name: PyPI
    if: tag IS present
    install: skip
    script: skip
    deploy:
      provider: script
      script: flit publish
      on:
        tags: true

notifications:
  email:
    on_success: never
    on_failure: change

sudo: false
language: python
python: 3.6

cache: pip

before_install: pip install flit
# Use `--deps production` so that we don't install unnecessary dependencies
install: flit install --deps production --extras test
script: pytest -m offline

jobs:
  include:
  - python: 2.7
    before_install:
    - sudo apt-get -y install python3-pip python3-setuptools
    - sudo pip3 install flit
    install: flit install --python python --deps production --extras test
  - python: 3.4
  - python: 3.5
  - python: 3.6
  - python: 3.7
    dist: xenial
    sudo: required
  - python: pypy3.5

  - name: Lint
    before_install: skip
    install: pip install black
    script: black --check --verbose .

  - stage: deploy
    name: Github Releases
    if: tag IS present
    install: skip
    script: flit build
    deploy:
      provider: releases
      api_key: $GITHUB_OAUTH_TOKEN
      file_glob: true
      file: dist/*
      skip_cleanup: true
      draft: false
      on:
        tags: true

  - stage: deploy
    name: PyPI
    if: tag IS present
    install: skip
    script: skip
    deploy:
      provider: script
      script: flit publish
      on:
        tags: true

notifications:
  email:
    on_success: never
    on_failure: change

Make Github Releases deploy in the published state
Make Github Releases deploy in the published state