Cannot upload wheel to both PyPI and Github Releases, dist directory empty after PyPI upload

Hello,

I would like to know how I could release the files published to Pypi to Github releases.

After deploying to pypi, these files should be maintained on the CI server (dist/reponame-0.0.1.tar.gz and dist/reponame-0.0.3-py3-none-any.whl). However, they are not released to github

language: python
python:
  - "3.7"

cache:
  directories:
    - $HOME/.cache/pip

install:
  - echo "========== INSTALL =========="
  - pip install -r requirements.txt
#  - pip install flake8

script: 
  - echo "========== TESTING =========="
  - python -m unittest test/test_*.py

before_deploy: echo "========== DEPLOYING =========="

deploy:
  - provider: pypi
    server: https://test.pypi.org/legacy/
    distributions: "sdist bdist_wheel"
    username: "__token__"
    password:
      secure: "pass"
    on:
      branch: master
      tags: true
  
  - provider: releases
    api_key:
      secure: "password"
    file_glob: true
    file: dist/*
    skip_cleanup: true
    on:
      branch: master
      tags: true

after_deploy:
  - ls -alh 
  - ls -alh dist/
  - ls -alh build/

I have tried other configurations for file but none work.

What am I missing?

Thanks

At first glance, this should work.
Could you link to a build?

Hello,
Thank you for looking at this.
https://api.travis-ci.com/v3/job/470164732/log.txt?log.token=Ph4RdkTNpyJ12yn2Gi7etg

It appears that the dist directory is empty. I use skip_cleanup: true, but I get a warning saying that this is deprecated.

It actually is! The PyPI deployment provider creates the distributions from scratch and deletes them right after uploading! https://github.com/travis-ci/dpl/blob/b577682ac17ff10b7f3fe58c5da1113b05e68cb7/lib/dpl/provider/pypi.rb#L134

You can use the DPL v2 version of the PyPI provider with edge: true and specify remove_build_dir: false to prevent that:

deploy:
- provider: pypi
  edge: true
  remove_build_dir: false
  <...>
- provider: releases
  <...>

Alright, this worked thanks!

However, I would like to ask you another thing: I would like to only trigger travis for branch master and when the commit is tagged (either only tags are pushed to the commit or not). I dont seem to make this trigger:
if: branch = master AND tag IS true
if: branch = master AND tag IS present
if: branch = master AND tag =~ ^v

I add this to the .travis.yml, right on the beggining after specifying language, but it does not work.

Also, what is travis default? Runs in all branches or just master branch? Thank you