Skip to content

Commit f95928b

Browse files
author
Wiktor Latanowicz
committed
Publish to pypi with gha
1 parent d2156d8 commit f95928b

File tree

5 files changed

+58
-1
lines changed

5 files changed

+58
-1
lines changed

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build-n-publish:
9+
name: Build and publish Python 🐍 distributions 📦 to PyPI
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Set up Python 3.9
15+
uses: actions/setup-python@v1
16+
with:
17+
python-version: 3.9
18+
19+
- name: Install pypa/build
20+
run: |
21+
python -m pip install build --user
22+
23+
- name: Set version
24+
run: |
25+
echo -n ${GITHUB_REF} | cut -f3- -d/ > ./indi/VERSION
26+
27+
- name: Build a 📦
28+
run: |
29+
python -m build
30+
31+
- name: Publish distribution 📦 to Test PyPI
32+
uses: pypa/gh-action-pypi-publish@release/v1.5
33+
with:
34+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
35+
repository_url: https://test.pypi.org/legacy/
36+
37+
- name: Publish distribution 📦 to PyPI
38+
if: startsWith(github.ref, 'refs/tags')
39+
uses: pypa/gh-action-pypi-publish@release/v1.5
40+
with:
41+
password: ${{ secrets.PYPI_API_TOKEN }}

MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include indi/VERSION
2+
recursive-include requirements *.txt
3+
4+
recursive-exclude * __pycache__
5+
recursive-exclude * *.py[co]

indi/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.2-dev

indi/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
__version__ = "0.2.0"
1+
from os import path
2+
3+
4+
with open(path.join(path.dirname(__file__), "VERSION")) as f:
5+
__version__ = f.read().strip()
6+
27
__protocol_version__ = "1.7"
38

49
__author__ = "Wiktor Latanowicz"

setup.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import re
22
from pathlib import Path
3+
from os import path
34

45
from setuptools import find_packages, setup
56

@@ -55,6 +56,10 @@ def get_about():
5556
if regex.match(l):
5657
dunders.append(l)
5758
exec("\n".join(dunders), about)
59+
60+
with open(path.join(path.dirname(__file__), "indi", "VERSION")) as f:
61+
about["__version__"] = f.read().strip()
62+
5863
return about
5964

6065
about = get_about()

0 commit comments

Comments
 (0)