From f955006e04896e0c2d04033225b0163125fa0d68 Mon Sep 17 00:00:00 2001 From: Ivan Toftul Date: Fri, 19 Jun 2026 10:22:40 +1000 Subject: [PATCH 1/3] Add PyPI publish workflow and PyPI metadata Add .github/workflows/publish.yml to auto-publish to PyPI on v* tags using Trusted Publishing (OIDC), with a guard that the tag matches the pyproject.toml version before building. Add license, homepage, repository, keywords, and classifiers to pyproject.toml so the PyPI project page is complete. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/publish.yml | 51 +++++++++++++++++++++++++++++++++++ pyproject.toml | 16 +++++++++++ 2 files changed, 67 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6546085 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,51 @@ +name: Publish to PyPI + +on: + push: + tags: + - "v*" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Check tag matches package version + run: | + TAG_VERSION="${GITHUB_REF_NAME#v}" + PKG_VERSION="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml","rb"))["tool"]["poetry"]["version"])')" + echo "Tag version: $TAG_VERSION" + echo "Package version: $PKG_VERSION" + if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then + echo "::error::Tag ($TAG_VERSION) does not match pyproject.toml version ($PKG_VERSION)" + exit 1 + fi + + - name: Build + run: | + python -m pip install --upgrade pip build + python -m build + + - uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + + publish: + needs: build + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write # required for trusted publishing + steps: + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/pyproject.toml b/pyproject.toml index 8a02d99..d6b3f58 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,22 @@ version = "1.0.2" description = "A python interface to the refractiveindex.info database." authors = ["Ivan Toftul "] readme = "README.md" +license = "MIT" +homepage = "https://github.com/toftul/refractiveindex" +repository = "https://github.com/toftul/refractiveindex" +keywords = ["optics", "refractive index", "photonics", "materials", "refractiveindex.info"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Topic :: Scientific/Engineering :: Physics", +] [tool.poetry.dependencies] python = "^3.10" From 37346dbaf4b98c775ff277df1aab719247392d57 Mon Sep 17 00:00:00 2001 From: Ivan Toftul Date: Fri, 19 Jun 2026 10:25:39 +1000 Subject: [PATCH 2/3] Reseale 1.0.3 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d6b3f58..f0ccca4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "refractiveindex" -version = "1.0.2" +version = "1.0.3" description = "A python interface to the refractiveindex.info database." authors = ["Ivan Toftul "] readme = "README.md" From 4cd4a67d4c013263260a077b9dd12b75f64222f1 Mon Sep 17 00:00:00 2001 From: Ivan Toftul Date: Fri, 19 Jun 2026 10:32:36 +1000 Subject: [PATCH 3/3] Release workflow for PyPI --- .github/workflows/publish.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6546085..0b5de52 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,9 +1,8 @@ name: Publish to PyPI on: - push: - tags: - - "v*" + release: + types: [published] jobs: build: @@ -15,14 +14,14 @@ jobs: with: python-version: "3.12" - - name: Check tag matches package version + - name: Check release tag matches package version run: | TAG_VERSION="${GITHUB_REF_NAME#v}" PKG_VERSION="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml","rb"))["tool"]["poetry"]["version"])')" - echo "Tag version: $TAG_VERSION" + echo "Release tag version: $TAG_VERSION" echo "Package version: $PKG_VERSION" if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then - echo "::error::Tag ($TAG_VERSION) does not match pyproject.toml version ($PKG_VERSION)" + echo "::error::Release tag ($TAG_VERSION) does not match pyproject.toml version ($PKG_VERSION)" exit 1 fi