Skip to content

Commit 164ef42

Browse files
authored
Add automatic deployment CI (#3)
Add a Github Action to automatically deploy to PyPI on every commit on a v*.* branch. We're using setuptools_scm to manage in-dev versions.
1 parent 16af534 commit 164ef42

2 files changed

Lines changed: 55 additions & 1 deletion

File tree

.github/workflows/deploy.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish package
2+
3+
on:
4+
push:
5+
branches: [ v*.* ]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: ['3.6']
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
# Include tags in the checkout
18+
fetch-depth: 0
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Get Pip cache directory
24+
id: pip-cache
25+
run: |
26+
echo "::set-output name=dir::$(pip cache dir)"
27+
- uses: actions/cache@v1
28+
id: cache
29+
with:
30+
path: ${{ steps.pip-cache.outputs.dir }}
31+
key: ${{ runner.os }}-pip-cache
32+
restore-keys: |
33+
${{ runner.os }}-pip-cache
34+
- name: Install dependencies
35+
run: |
36+
pip install --upgrade setuptools wheel twine
37+
- name: Publish
38+
env:
39+
TWINE_USERNAME: __token__
40+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
41+
run: |
42+
python3 setup.py sdist bdist_wheel
43+
python3 -m twine upload dist/*

setup.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,26 @@
22

33
setup(
44
name="brainframe-api",
5-
version="0.26.0",
65
description="Provides a Python wrapper around the BrainFrame REST API.",
76
long_description=open("README.rst").read(),
87
author="Aotu",
98
url="https://github.com/aotuai/brainframe_python",
109
license="BSD-3-Clause",
10+
11+
setup_requires=[
12+
"setuptools_scm",
13+
],
14+
use_scm_version={
15+
# We want to be able to push these releases to PyPI, which doesn't
16+
# support local versions. Local versions are anything after the "+" in
17+
# a version string like "0.26.0.dev16+cooltext".
18+
"local_scheme": "no-local-version",
19+
},
20+
1121
packages=find_namespace_packages(
1222
include=["brainframe.api*"]
1323
),
24+
1425
install_requires=[
1526
"requests==2.*",
1627
"pillow==6.*",

0 commit comments

Comments
 (0)