Skip to content

Commit 383eba3

Browse files
committed
pypoetry for pypi releases
1 parent 4d21fc3 commit 383eba3

File tree

1 file changed

+24
-31
lines changed

1 file changed

+24
-31
lines changed

.github/workflows/publish-pypi.yml

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,43 @@
11
name: Publish Pypi
22
on:
33
release:
4-
types: [published]
4+
types: [ published ]
55

66
jobs:
7-
publish:
8-
name: publish
7+
pytest:
8+
name: Publish to PyPi
99
runs-on: ubuntu-latest
10+
env:
11+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
1012
steps:
1113
- uses: actions/checkout@master
12-
- name: Set up Python 2.7
14+
- name: Set up Python 3.7
1315
uses: actions/setup-python@v1
1416
with:
15-
python-version: 2.7
17+
python-version: 3.7
1618

17-
- name: Install twine
18-
run: |
19-
pip install twine
20-
21-
- name: Install wheel
22-
run: |
23-
pip install wheel
24-
25-
- name: Create a source distribution
26-
run: |
27-
python setup.py sdist
19+
- name: Install Poetry
20+
uses: dschep/[email protected]
2821

29-
- name: Create a wheel
30-
run: |
31-
python setup.py bdist_wheel
22+
- name: Cache Poetry virtualenv
23+
uses: actions/cache@v1
24+
id: cache
25+
with:
26+
path: ~/.virtualenvs
27+
key: poetry-${{ hashFiles('**/poetry.lock') }}
28+
restore-keys: |
29+
poetry-${{ hashFiles('**/poetry.lock') }}
3230
33-
- name: Create a .pypirc
31+
- name: Set Poetry config
3432
run: |
35-
echo -e "[pypi]" >> ~/.pypirc
36-
echo -e "username = __token__" >> ~/.pypirc
37-
echo -e "password = ${{ secrets.PYPI_TOKEN }}" >> ~/.pypirc
38-
echo -e "[testpypi]" >> ~/.pypirc
39-
echo -e "username = __token__" >> ~/.pypirc
40-
echo -e "password = ${{ secrets.TESTPYPI_TOKEN }}" >> ~/.pypirc
33+
poetry config virtualenvs.in-project false
34+
poetry config virtualenvs.path ~/.virtualenvs
4135
42-
- name: Publish to Test PyPI
43-
if: github.event_name == 'release'
44-
run: |
45-
twine upload --skip-existing -r testpypi dist/*
36+
- name: Install Dependencies
37+
run: poetry install
38+
if: steps.cache.outputs.cache-hit != 'true'
4639

4740
- name: Publish to PyPI
4841
if: github.event_name == 'release'
4942
run: |
50-
twine upload -r pypi dist/*
43+
poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }} --build

0 commit comments

Comments
 (0)