Skip to content

Commit 1f56719

Browse files
authored
Add publish workflow (#2)
1 parent 8b1753b commit 1f56719

File tree

6 files changed

+39
-5
lines changed

6 files changed

+39
-5
lines changed

.github/workflows/black.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
name: Lint
2-
1+
name: Format and lint
32
on:
43
push:
54
branches:
65
- main
76
pull_request:
8-
97
jobs:
108
lint:
119
runs-on: ubuntu-latest

.github/workflows/publish.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Publish to PyPi
2+
on:
3+
release:
4+
types: [created]
5+
6+
jobs:
7+
publish:
8+
name: Publish
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v2
13+
14+
- name: Setup Python
15+
- uses: actions/setup-python@v2
16+
with:
17+
python-version: '3.x'
18+
19+
- name: Install dependencies
20+
run: make build
21+
22+
- name: Run tests
23+
env:
24+
SANDBOX_API_KEY: ${{ secrets.SANDBOX_API_KEY }}
25+
run: make test
26+
27+
- name: Publish to PyPi
28+
run: make publish
29+

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test
1+
name: Run tests
22
on:
33
push:
44
branches:

.pypirc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[pypi]
2+
username = __token__
3+
password = ${{ secrets.PYPI_UPLOAD_TOKEN }}

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ test:
1111
pip install -r test-requirements.txt && \
1212
python -m unittest discover test/
1313

14+
publish:
15+
python3 -m pip install --user --upgrade twine && \
16+
python3 -m twine upload -r pypi dist/* --config-file .pypirc
17+
1418
.PHONY: build test lint

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@
3838
packages=find_packages(exclude=["test", "tests"]),
3939
include_package_data=True,
4040
long_description="""\
41-
The core API used to integrate with Patch's service # noqa: E501
41+
The core API used to integrate with Patch's service.
4242
""",
4343
)

0 commit comments

Comments
 (0)