Skip to content

Commit bdb5d08

Browse files
authored
Merge pull request #39 from PolymathicAI/versionning
adding pypi upload and versionning
2 parents 1363b76 + 72f6c43 commit bdb5d08

File tree

2 files changed

+59
-2
lines changed

2 files changed

+59
-2
lines changed

.github/workflows/publish-pypi.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Triggers on version tags like v1.0.0, v0.1.2, etc.
7+
8+
jobs:
9+
publish:
10+
name: Publish to PyPI
11+
runs-on: ubuntu-latest
12+
environment:
13+
name: pypi
14+
url: https://pypi.org/p/polymathic-aion
15+
permissions:
16+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0 # Fetch full history for setuptools_scm
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: '3.11'
28+
29+
- name: Install build dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
python -m pip install build
33+
34+
- name: Build package
35+
run: python -m build
36+
37+
- name: Verify version matches tag
38+
run: |
39+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
40+
PACKAGE_VERSION=$(python -c "import setuptools_scm; print(setuptools_scm.get_version())")
41+
echo "Tag version: $TAG_VERSION"
42+
echo "Package version: $PACKAGE_VERSION"
43+
if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
44+
echo "Version mismatch! Tag: $TAG_VERSION, Package: $PACKAGE_VERSION"
45+
exit 1
46+
fi
47+
48+
- name: Publish to PyPI
49+
uses: pypa/gh-action-pypi-publish@release/v1
50+
# This action uses OIDC trusted publishing - no API tokens needed!
51+
# Just configure your PyPI project to trust this GitHub repository

pyproject.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[build-system]
2-
requires = ["setuptools>=61"]
2+
requires = ["setuptools>=61", "setuptools_scm>=8.0"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "aion"
7-
version = "0.0.1"
7+
dynamic = ["version"]
88
description = "AstronomIcal Omnimodal Network"
99
requires-python = ">=3.10"
1010
dependencies = [
@@ -43,3 +43,9 @@ ignore = ["F722"]
4343
[tool.setuptools.packages.find]
4444
include = ["aion*"]
4545
# Only include the 'aion' package and its subpackages
46+
47+
[tool.setuptools_scm]
48+
# This section configures setuptools_scm
49+
# It will use git tags to determine version numbers
50+
# If no tags exist, it will use 0.1.dev0+g<commit_hash>
51+
fallback_version = "0.1.dev0"

0 commit comments

Comments
 (0)