@@ -205,24 +205,40 @@ jobs:
205205 steps :
206206 - name : Checkout repository
207207 uses : actions/checkout@v4
208+ with :
209+ fetch-depth : 0 # Required for setuptools-scm to determine the version
208210
209- - name : Log in to Docker Hub
210- uses : docker/login-action@v3
211+ - name : Setup Python
212+ uses : actions/setup-python@v5
211213 with :
212- username : ${{ secrets.DOCKER_USERNAME }}
213- password : ${{ secrets.DOCKER_PASSWORD }}
214+ python-version : ' 3.x' # Use a recent Python version
214215
215- - name : Get version from Git tag
216+ - name : Install setuptools-scm
217+ run : pip install setuptools-scm
218+
219+ - name : Generate _version.py
220+ run : python -m setuptools_scm write_version_to_file _version.py
221+
222+ - name : Get version from _version.py
216223 id : get_version
217224 run : |
218- VERSION="${{ github.ref_name }}"
219- VERSION="${VERSION#v}" # Remove leading 'v'
225+ # Read the __version__ variable from the generated _version.py
226+ VERSION=$(python -c "import _version; print(_version.__version__)")
227+ # Remove leading 'v' if present (e.g., v1.0.0 -> 1.0.0)
228+ VERSION="${VERSION#v}"
229+ # Extract major version (e.g., 1.0.0 -> 1)
220230 MAJOR_VERSION=$(echo "$VERSION" | cut -d. -f1)
221231 echo "VERSION=$VERSION" >> $GITHUB_ENV
222232 echo "MAJOR_VERSION=$MAJOR_VERSION" >> $GITHUB_ENV
223233 echo "Extracted VERSION: $VERSION"
224234 echo "Extracted MAJOR_VERSION: $MAJOR_VERSION"
225235
236+ - name : Log in to Docker Hub
237+ uses : docker/login-action@v3
238+ with :
239+ username : ${{ secrets.DOCKER_USERNAME }}
240+ password : ${{ secrets.DOCKER_PASSWORD }}
241+
226242 # --- Build and push FULL image (with WhisperX) ---
227243 - name : Build and push FULL Docker image
228244 uses : docker/build-push-action@v5
0 commit comments