From c74e216ef0fb9b40bb75a341448b9f6f87cc1a5d Mon Sep 17 00:00:00 2001 From: Bob Clough Date: Tue, 5 Dec 2023 12:15:02 +0000 Subject: [PATCH 1/2] Github action to push to pypi Pushes to test pypi every push Pushes to real pypi if tagged --- .github/workflows/release.yml | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..37050de --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Publish to PyPI on tagging + +on: push + +jobs: + pypi-publish: + name: Upload release to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/ct-lifecycle + permissions: + id-token: write + steps: + - uses: actions/checkout@v3 + with: + # checkout full tree + fetch-depth: 0 + + - name: Set up Python 3.9 + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install pypa/build + run: >- + python -m + pip install + build + --user + + - name: Build a binary wheel and a source tarball + run: >- + python -m + build + --sdist + --wheel + --outdir dist/ + . + + - name: Publish to test PyPI always + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository-url: https://test.pypi.org/legacy/ + + - name: Publish to PyPI on tag + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} From 899ce5e9f31f3813dc4be4c09809e0f2ea50ed9b Mon Sep 17 00:00:00 2001 From: Bob Clough Date: Tue, 5 Dec 2023 13:50:19 +0000 Subject: [PATCH 2/2] fix dynamic pyproject setup --- docs/source/conf.py | 2 +- lifecycle/__init__.py | 2 ++ pyproject.toml | 7 +++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index c8c05f5..b7133a3 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -13,7 +13,7 @@ author = "Codethink Ltd" release = "0.1" -version = "0.1.0" +version = "0.1.1" # -- General configuration diff --git a/lifecycle/__init__.py b/lifecycle/__init__.py index ff1d282..fe97431 100644 --- a/lifecycle/__init__.py +++ b/lifecycle/__init__.py @@ -1,5 +1,7 @@ """Lifecycle management namespace""" +__version__ = "0.1.1" + from abc import ABC, abstractmethod from collections.abc import Mapping import logging diff --git a/pyproject.toml b/pyproject.toml index 7bd7948..36f5801 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,12 +5,15 @@ build-backend = "setuptools.build_meta" [project] name = "ct_lifecycle" description = "Assert the SSOT principle for users and groups across disparate applications and services." -readme = "README.md" requires-python = ">=3.9" license = {text = "MIT"} classifiers = [ "Programming Language :: Python :: 3", ] -dynamic = ["version"] +dynamic = ["version", "readme", "scripts", "dependencies", "optional-dependencies"] + +[tool.setuptools.dynamic] +readme = {file = ["README.md"], content-type = "text/markdown"} +version = {attr = "lifecycle.__version__"} [tool.setuptools_scm]