Skip to content

Commit 6ed79e9

Browse files
Fixed versions
1 parent 1d9c91e commit 6ed79e9

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

.github/workflows/ci-cd.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,22 +220,22 @@ jobs:
220220
- name: Get Version for Docker Build
221221
id: get_version
222222
run: |
223-
# Fetch all tags to ensure we have the complete history
223+
# Ensure we have tags
224224
git fetch --tags --force
225225
226-
# Get the latest tag, remove 'v' prefix, use default if no tags
227-
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.1.0")
228-
VERSION="${VERSION#v}"
229-
230226
# For tagged builds, use the exact tag
231227
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
232228
TAG=${GITHUB_REF#refs/tags/}
233-
VERSION="${TAG#v}"
234-
echo "Using tag version: $VERSION (from $TAG)"
229+
# Keep the v prefix for git tags
230+
VERSION="$TAG"
231+
echo "Using tag version: $VERSION"
235232
else
233+
# Use git version with v prefix
234+
VERSION=$(git describe --tags --always 2>/dev/null || echo "v0.1.0")
236235
echo "Using git version: $VERSION"
237236
fi
238237
238+
# Output for GitHub Actions
239239
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
240240
241241
- name: Build and Push Docker Image

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ ARG VERSION="0.1.0"
66

77
WORKDIR /app
88

9-
# Install git to properly detect version during build
9+
# Install git for versioning
1010
RUN apt-get update && apt-get install -y git && apt-get clean && rm -rf /var/lib/apt/lists/*
1111

1212
# Copy requirements and install dependencies first
1313
COPY requirements.txt .
1414
RUN pip install --no-cache-dir -r requirements.txt
1515

16-
# Copy everything needed for versioning and installation
16+
# Copy source code for installation
1717
COPY . .
1818

19-
# Disable setuptools_scm and use the provided version
19+
# Use setuptools_scm with the version passed from the build
2020
ENV SETUPTOOLS_SCM_PRETEND_VERSION=$VERSION
2121

22-
# Install the package with proper versioning support
22+
# Install the package
2323
RUN pip install --no-cache-dir .
2424

2525
# Create a wrapper script to allow more flexibility

0 commit comments

Comments
 (0)