diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d8b10e3..e1d3652 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -59,13 +59,13 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | - SETUPTOOLS_SCM_PRETEND_VERSION=${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || format('0.0.0.dev0+g{0}', github.sha) }} + BUILD_VERSION=${{ github.ref_name }} cache-from: type=gha cache-to: type=gha,mode=max - name: Test Docker image if: github.event_name == 'pull_request' run: | - docker build -t meshcore-hub-test --build-arg SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0.dev0+g${{ github.sha }} -f Dockerfile . + docker build -t meshcore-hub-test --build-arg BUILD_VERSION=${{ github.ref_name }} -f Dockerfile . docker run --rm meshcore-hub-test --version docker run --rm meshcore-hub-test --help diff --git a/Dockerfile b/Dockerfile index 3d4766e..a645c68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,9 +21,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ RUN python -m venv /opt/venv ENV PATH="/opt/venv/bin:$PATH" -# Build argument for version (set via CI or manually) -ARG SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0+docker - # Copy project files WORKDIR /app COPY pyproject.toml README.md ./ @@ -31,9 +28,13 @@ COPY src/ ./src/ COPY alembic/ ./alembic/ COPY alembic.ini ./ -# Install the package with version from build arg -RUN pip install --upgrade pip && \ - SETUPTOOLS_SCM_PRETEND_VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION} pip install . +# Build argument for version (set via CI or manually) +ARG BUILD_VERSION=dev + +# Set version in _version.py and install the package +RUN sed -i "s/__version__ = \"dev\"/__version__ = \"${BUILD_VERSION}\"/" src/meshcore_hub/_version.py && \ + pip install --upgrade pip && \ + pip install . # ============================================================================= # Stage 2: Runtime - Final production image diff --git a/pyproject.toml b/pyproject.toml index 79b7853..c333366 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["setuptools>=68.0", "wheel", "setuptools-scm>=8.0"] +requires = ["setuptools>=68.0", "wheel"] build-backend = "setuptools.build_meta" [project] name = "meshcore-hub" -dynamic = ["version"] +version = "0.0.0" description = "Python monorepo for managing and orchestrating MeshCore mesh networks" readme = "README.md" license = {text = "GPL-3.0-or-later"} @@ -68,10 +68,6 @@ Documentation = "https://github.com/ipnet-mesh/meshcore-hub#readme" Repository = "https://github.com/ipnet-mesh/meshcore-hub" Issues = "https://github.com/ipnet-mesh/meshcore-hub/issues" -[tool.setuptools_scm] -version_file = "src/meshcore_hub/_version.py" -fallback_version = "0.0.0+unknown" - [tool.setuptools.packages.find] where = ["src"] diff --git a/src/meshcore_hub/__init__.py b/src/meshcore_hub/__init__.py index 552bf5c..9f05ead 100644 --- a/src/meshcore_hub/__init__.py +++ b/src/meshcore_hub/__init__.py @@ -1,5 +1,5 @@ """MeshCore Hub - Python monorepo for managing MeshCore mesh networks.""" -from meshcore_hub._version import __version__, __version_tuple__ +from meshcore_hub._version import __version__ -__all__ = ["__version__", "__version_tuple__"] +__all__ = ["__version__"] diff --git a/src/meshcore_hub/web/templates/base.html b/src/meshcore_hub/web/templates/base.html index 5cdd510..7650fba 100644 --- a/src/meshcore_hub/web/templates/base.html +++ b/src/meshcore_hub/web/templates/base.html @@ -83,7 +83,7 @@
@@ -114,7 +114,7 @@ GitHub {% endif %} -Powered by MeshCore Hub v{{ version }}
+Powered by MeshCore Hub {{ version }}