Skip to content

Commit ec45561

Browse files
authored
Merge pull request #68 from labthings/test-pypi
Publish to pypi
2 parents e205073 + e53b8b5 commit ec45561

File tree

3 files changed

+77
-16
lines changed

3 files changed

+77
-16
lines changed

.github/workflows/publish.yml

Lines changed: 72 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,77 @@
1-
name: Publish
1+
name: Publish to TestPyPI
22

3-
on:
4-
release:
5-
types: [published]
3+
on: push
64

7-
jobs:
8-
test:
9-
uses: ./github/workflows/test.yml
5+
#on:
6+
# release:
7+
# types: [published]
108

11-
publish:
12-
runs-on: ubuntu-latest
13-
needs: test
9+
jobs:
10+
build:
11+
name: Build distribution 📦
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.x"
20+
- name: Install pypa/build
21+
run: >-
22+
python3 -m
23+
pip install
24+
build
25+
--user
26+
- name: Build a binary wheel and a source tarball
27+
run: python3 -m build
28+
- name: Store the distribution packages
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: python-package-distributions
32+
path: dist/
1433

15-
steps:
16-
- uses: actions/checkout@v1
34+
publish-to-testpypi:
35+
name: Publish Python 🐍 distribution 📦 to TestPyPI
36+
needs:
37+
- build
38+
runs-on: ubuntu-latest
39+
40+
environment:
41+
name: testpypi
42+
url: https://test.pypi.org/p/labthings-fastapi
43+
44+
permissions:
45+
id-token: write # IMPORTANT: mandatory for trusted publishing
46+
47+
steps:
48+
- name: Download all the dists
49+
uses: actions/download-artifact@v4
1750
with:
18-
fetch-depth: 1
51+
name: python-package-distributions
52+
path: dist/
53+
- name: Publish distribution 📦 to TestPyPI
54+
uses: pypa/gh-action-pypi-publish@release/v1
55+
with:
56+
repository-url: https://test.pypi.org/legacy/
57+
58+
publish-to-pypi:
59+
name: >-
60+
Publish Python 🐍 distribution 📦 to PyPI
61+
if: startsWith(github.ref, 'refs/tags/v') # only publish to PyPI on tag pushes
62+
needs:
63+
- build
64+
runs-on: ubuntu-latest
65+
environment:
66+
name: pypi
67+
url: https://pypi.org/p/labthings-fastapi
68+
permissions:
69+
id-token: write # IMPORTANT: mandatory for trusted publishing
70+
steps:
71+
- name: Download all the dists
72+
uses: actions/download-artifact@v4
73+
with:
74+
name: python-package-distributions
75+
path: dist/
76+
- name: Publish distribution 📦 to PyPI
77+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
python-version: ${{ matrix.python }}
2121

2222
- name: Install Dependencies
23-
run: pip install -e .[dev]
23+
run: pip install -e .[dev,server]
2424

2525
- name: Lint with Ruff
2626
run: ruff check .

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "labthings-fastapi"
3-
version = "0.0.0"
3+
version = "0.0.1"
44
authors = [
55
{ name="Richard Bowman", email="[email protected]" },
66
]
@@ -13,7 +13,6 @@ classifiers = [
1313
"Operating System :: OS Independent",
1414
]
1515
dependencies = [
16-
"fastapi[all]>=0.104.0",
1716
"pydantic>=2.0.0",
1817
"jsonschema",
1918
"typing_extensions",
@@ -29,6 +28,9 @@ dev = [
2928
"types-jsonschema",
3029
"numpy~=1.20",
3130
]
31+
server = [
32+
"fastapi[all]>=0.104.0", # NB must match FastAPI above
33+
]
3234

3335
[project.urls]
3436
"Homepage" = "https://github.com/rwb27/labthings-fastapi"

0 commit comments

Comments
 (0)