Skip to content
This repository was archived by the owner on Jan 24, 2023. It is now read-only.

Commit f8ed3b9

Browse files
Using github actions to publish to PyPi (#74)
* [add] using github actions to publish to PyPi * [fix] Fixed identation in publish-pypi yaml * [fix] Publish to PyPi github action working as expected
1 parent 2f169b8 commit f8ed3b9

File tree

4 files changed

+54
-50
lines changed

4 files changed

+54
-50
lines changed

.circleci/config.yml

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -108,44 +108,6 @@ jobs:
108108
# Must be relative path from root
109109
paths:
110110
- dist-<< parameters.python_version >>
111-
112-
publish-release-pypi:
113-
parameters:
114-
python_version:
115-
default: "2.7"
116-
type: string
117-
executor:
118-
name: container_versions
119-
python_version: <<parameters.python_version>>
120-
working_directory: ~/repo
121-
steps:
122-
- attach_workspace:
123-
# Must be absolute path or relative path from working_directory
124-
at: .
125-
126-
- run:
127-
name: Install twine
128-
command: pip install twine
129-
130-
- run:
131-
name: Create a .pypirc
132-
command: |
133-
echo -e "[pypi]" >> ~/.pypirc
134-
echo -e "username = __token__" >> ~/.pypirc
135-
echo -e "password = $PYPI_TOKEN" >> ~/.pypirc
136-
echo -e "[testpypi]" >> ~/.pypirc
137-
echo -e "username = __token__" >> ~/.pypirc
138-
echo -e "password = $TESTPYPI_TOKEN" >> ~/.pypirc
139-
140-
- run:
141-
name: Upload with twine to Test PyPI
142-
command: twine upload --skip-existing -r testpypi dist-<< parameters.python_version >>/*
143-
144-
- run:
145-
name: Upload with twine to PyPI
146-
command: twine upload -r pypi dist-<< parameters.python_version >>/*
147-
148-
149111

150112
workflows:
151113
version: 2
@@ -161,19 +123,10 @@ workflows:
161123
- '3.7'
162124
- '3.8'
163125
- '3.9.0rc2'
164-
filters: # required since `publish-release-pypi` has tag filters AND requires `build`
126+
filters:
165127
tags:
166128
only: /.*/
167129
- build
168-
- publish-release-pypi:
169-
requires:
170-
- build-2.7
171-
python_version: "2.7"
172-
filters:
173-
tags:
174-
only: /^v.*/
175-
branches:
176-
ignore: /.*/
177130

178131
nightly:
179132
triggers:

.github/release-drafter-config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name-template: 'Version $NEXT_PATCH_VERSION🌈'
1+
name-template: 'Version $NEXT_PATCH_VERSION'
22
tag-template: 'v$NEXT_PATCH_VERSION'
33
categories:
44
- title: '🚀Features'
@@ -10,7 +10,7 @@ categories:
1010
- 'fix'
1111
- 'bugfix'
1212
- 'bug'
13-
- title: '🧰Maintenance'
13+
- title: 'Maintenance'
1414
label: 'chore'
1515
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
1616
exclude-labels:

.github/workflows/publish-pypi.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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/*

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
__pycache__/
33
*.py[cod]
44
*$py.class
5+
.idea/
56

67
# C extensions
78
*.so

0 commit comments

Comments
 (0)