File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -6,20 +6,20 @@ ARG VERSION="0.1.0"
66
77WORKDIR /app
88
9- # Install git to properly detect version during build
9+ # Install git for versioning
1010RUN 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
1313COPY requirements.txt .
1414RUN pip install --no-cache-dir -r requirements.txt
1515
16- # Copy everything needed for versioning and installation
16+ # Copy source code for installation
1717COPY . .
1818
19- # Disable setuptools_scm and use the provided version
19+ # Use setuptools_scm with the version passed from the build
2020ENV SETUPTOOLS_SCM_PRETEND_VERSION=$VERSION
2121
22- # Install the package with proper versioning support
22+ # Install the package
2323RUN pip install --no-cache-dir .
2424
2525# Create a wrapper script to allow more flexibility
You can’t perform that action at this time.
0 commit comments