@@ -35,27 +35,34 @@ jobs:
35
35
python-version : ${{ matrix.python-version }}
36
36
- name : Display Python version
37
37
run : python -c "import sys; print(sys.version)"
38
- - name : Check python version and upgrade pip
38
+ - name : Check python version and install build
39
39
run : |
40
40
python --version
41
- python -m pip install -U pip setuptools virtualenv twine
41
+ python -m pip install -U build twine
42
42
- name : Build fitlins
43
43
run : |
44
- virtualenv --python=python /tmp/venv/build
45
- source /tmp/venv/build/bin/activate
46
- pip install --upgrade pip setuptools wheel
47
- python setup.py sdist
48
- pip wheel --no-deps -w dist/ .
44
+ python -m build
45
+ - name : Check distributions
46
+ run : twine check dist/*
47
+ - name : Check for PyPI token
48
+ id : deployable
49
+ env :
50
+ TEST_PYPI_API_TOKEN : ${{ secrets.TEST_PYPI_API_TOKEN }}
51
+ PYPI_API_TOKEN : ${{ secrets.PYPI_API_TOKEN }}
52
+ run : |
53
+ if [ -n "$PYPI_API_TOKEN" ]; then echo ::set-output name=DEPLOY::true; fi
54
+ if [ -n "$TEST_PYPI_API_TOKEN" ]; then echo ::set-output name=TEST_DEPLOY::true; fi
49
55
- name : Test PyPI upload
50
- uses : pypa/gh-action-pypi-publish@master
56
+ if : steps.deployable.outputs.TEST_DEPLOY
57
+ uses : pypa/gh-action-pypi-publish@release/v1
51
58
with :
52
59
user : __token__
53
60
password : ${{ secrets.TEST_PYPI_API_TOKEN }}
54
61
repository_url : https://test.pypi.org/legacy/
55
62
skip_existing : true
56
63
- name : Upload to PyPI (on tags)
57
- if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
58
- uses : pypa/gh-action-pypi-publish@master
64
+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && steps.deployable.outputs.DEPLOY
65
+ uses : pypa/gh-action-pypi-publish@release/v1
59
66
with :
60
67
user : __token__
61
68
password : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments