Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish to pypi #68

Merged
merged 2 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 72 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,77 @@
name: Publish
name: Publish to TestPyPI

on:
release:
types: [published]
on: push

jobs:
test:
uses: ./github/workflows/test.yml
#on:
# release:
# types: [published]

publish:
runs-on: ubuntu-latest
needs: test
jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

steps:
- uses: actions/checkout@v1
publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/labthings-fastapi

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
fetch-depth: 1
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/v') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/labthings-fastapi
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
python-version: ${{ matrix.python }}

- name: Install Dependencies
run: pip install -e .[dev]
run: pip install -e .[dev,server]

- name: Lint with Ruff
run: ruff check .
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "labthings-fastapi"
version = "0.0.0"
version = "0.0.1"
authors = [
{ name="Richard Bowman", email="[email protected]" },
]
Expand All @@ -13,7 +13,6 @@ classifiers = [
"Operating System :: OS Independent",
]
dependencies = [
"fastapi[all]>=0.104.0",
"pydantic>=2.0.0",
"jsonschema",
"typing_extensions",
Expand All @@ -29,6 +28,9 @@ dev = [
"types-jsonschema",
"numpy~=1.20",
]
server = [
"fastapi[all]>=0.104.0", # NB must match FastAPI above
]

[project.urls]
"Homepage" = "https://github.com/rwb27/labthings-fastapi"
Expand Down
Loading