File tree Expand file tree Collapse file tree 2 files changed +77
-0
lines changed
Expand file tree Collapse file tree 2 files changed +77
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Check if required secrets are set to publish to Pypi
2+
3+ on : push
4+
5+ jobs :
6+ checksecret :
7+ name : check if PYPI_TOKEN and TESTPYPI_TOKEN are set in github secrets
8+ runs-on : ubuntu-latest
9+ steps :
10+ - name : Check PYPI_TOKEN
11+ env :
12+ PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
13+ run : |
14+ if ${{ env.PYPI_TOKEN == '' }} ; then
15+ echo "PYPI_TOKEN secret is not set"
16+ exit 1
17+ fi
18+ - name : Check TESTPYPI_TOKEN
19+ env :
20+ TESTPYPI_TOKEN : ${{ secrets.TESTPYPI_TOKEN }}
21+ run : |
22+ if ${{ env.TESTPYPI_TOKEN == '' }} ; then
23+ echo "TESTPYPI_TOKEN secret is not set"
24+ exit 1
25+ fi
26+
27+
Original file line number Diff line number Diff line change 1+ name : Publish Pypi
2+ on :
3+ release :
4+ types : [published]
5+
6+ jobs :
7+ publish :
8+ name : publish
9+ runs-on : ubuntu-latest
10+ steps :
11+ - uses : actions/checkout@master
12+ - name : Set up Python 2.7
13+ uses : actions/setup-python@v1
14+ with :
15+ python-version : 2.7
16+
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
28+
29+ - name : Create a wheel
30+ run : |
31+ python setup.py bdist_wheel
32+
33+ - name : Create a .pypirc
34+ 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
41+
42+ - name : Publish to Test PyPI
43+ if : github.event_name == 'release'
44+ run : |
45+ twine upload --skip-existing -r testpypi dist/*
46+
47+ - name : Publish to PyPI
48+ if : github.event_name == 'release'
49+ run : |
50+ twine upload -r pypi dist/*
You can’t perform that action at this time.
0 commit comments