diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..0b5de52 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,50 @@ +name: Publish to PyPI + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - 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 "Release tag version: $TAG_VERSION" + echo "Package version: $PKG_VERSION" + if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then + echo "::error::Release 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..f0ccca4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,25 @@ [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" +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"