diff --git a/.github/workflows/build-push-backend.yml b/.github/workflows/build-push-backend.yml index 2536145..51bc911 100644 --- a/.github/workflows/build-push-backend.yml +++ b/.github/workflows/build-push-backend.yml @@ -94,6 +94,16 @@ jobs: type=semver,pattern={{major}} type=sha + - name: Extract version + id: version + run: | + if [[ "${{ github.ref }}" == refs/tags/* ]]; then + VERSION=${GITHUB_REF#refs/tags/} + else + VERSION="dev-${GITHUB_SHA::7}" + fi + echo "version=$VERSION" >> $GITHUB_OUTPUT + - name: Build and push Docker image uses: docker/build-push-action@v6 with: @@ -104,4 +114,4 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | - VERSION=${{ steps.meta.outputs.version }} + VERSION=${{ steps.version.outputs.version }}