@@ -15,17 +15,37 @@ before_install:
1515 echo "Git ref: $GIT_TAG"
1616 echo "Git commit: $GIT_COMMIT"
1717 echo "Git branch: $GIT_BRANCH"
18+ echo "JitPack VERSION: $VERSION"
1819
19- # Determine the tag - JitPack might use different variable names
20- # Try GIT_TAG first, then fall back to extracting from git
20+ # Determine the tag - JitPack passes the requested version
21+ # Try multiple JitPack environment variables in order of preference
2122 if [ -n "$GIT_TAG" ]; then
2223 RELEASE_TAG="$GIT_TAG"
24+ echo "Using GIT_TAG: $RELEASE_TAG"
25+ elif [ -n "$VERSION" ]; then
26+ # JitPack sets VERSION to the requested tag/version
27+ RELEASE_TAG="$VERSION"
28+ echo "Using VERSION: $RELEASE_TAG"
2329 else
24- # Try to get tag from git
25- RELEASE_TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
30+ # Fallback: Get all tags for current commit and prefer kotlin-utils-* tags
31+ echo "Attempting to determine tag from git..."
32+ ALL_TAGS=$(git tag --points-at HEAD 2>/dev/null || echo "")
33+ echo "Tags at HEAD: $ALL_TAGS"
34+
35+ # Try to find kotlin-utils-* tag first (for utils variant)
36+ UTILS_TAG=$(echo "$ALL_TAGS" | grep "^kotlin-utils-" | head -1)
37+ if [ -n "$UTILS_TAG" ]; then
38+ RELEASE_TAG="$UTILS_TAG"
39+ echo "Found utils tag: $RELEASE_TAG"
40+ else
41+ # Otherwise use any tag (for base variant)
42+ RELEASE_TAG=$(echo "$ALL_TAGS" | head -1)
43+ echo "Found base tag: $RELEASE_TAG"
44+ fi
45+
2646 if [ -z "$RELEASE_TAG" ]; then
2747 echo "ERROR: Could not determine release tag!"
28- echo "GIT_TAG is not set and git describe failed ."
48+ echo "GIT_TAG, VERSION not set and no tags found at HEAD ."
2949 echo ""
3050 echo "JitPack can only build from tagged releases."
3151 echo "To use this library:"
@@ -112,8 +132,19 @@ install:
112132 # Determine the tag (same logic as before_install)
113133 if [ -n "$GIT_TAG" ]; then
114134 RELEASE_TAG="$GIT_TAG"
135+ elif [ -n "$VERSION" ]; then
136+ # JitPack sets VERSION to the requested tag/version
137+ RELEASE_TAG="$VERSION"
115138 else
116- RELEASE_TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
139+ # Fallback: Get all tags for current commit and prefer kotlin-utils-* tags
140+ ALL_TAGS=$(git tag --points-at HEAD 2>/dev/null || echo "")
141+ UTILS_TAG=$(echo "$ALL_TAGS" | grep "^kotlin-utils-" | head -1)
142+ if [ -n "$UTILS_TAG" ]; then
143+ RELEASE_TAG="$UTILS_TAG"
144+ else
145+ RELEASE_TAG=$(echo "$ALL_TAGS" | head -1)
146+ fi
147+
117148 if [ -z "$RELEASE_TAG" ]; then
118149 echo "ERROR: Could not determine release tag in install step!"
119150 exit 1
0 commit comments