@@ -92,10 +92,7 @@ if [[ -z "$appVersion" && -z "$apkPath" ]]; then
9292 exit 1
9393fi
9494
95- # When verifying a GitHub release, the repo must be at the matching tag so the
96- # Docker build uses the same source (and thus the same SOURCE_DATE_EPOCH).
97- # When --apk is provided the caller controls both APKs, so this check is skipped.
98- if [[ -z " $apkPath " ]]; then
95+ if [[ -n " $appVersion " ]]; then
9996 expectedTag=" v${appVersion} "
10097 localTag=$( git -C " $REPO_ROOT " tag --points-at HEAD 2> /dev/null | grep -x " $expectedTag " || true)
10198 if [[ -z " $localTag " ]]; then
@@ -167,6 +164,14 @@ if [[ -z "$appVersion" ]]; then
167164 exit 1
168165 fi
169166 echo " Version (from APK): $appVersion "
167+ expectedTag=" v${appVersion} "
168+ localTag=$( git -C " $REPO_ROOT " tag --points-at HEAD 2> /dev/null | grep -x " $expectedTag " || true)
169+ if [[ -z " $localTag " ]]; then
170+ currentRef=$( git -C " $REPO_ROOT " describe --tags --always 2> /dev/null || echo " unknown" )
171+ echo -e " ${RED} Error: local repo is not at tag $expectedTag (currently at: $currentRef )${NC} "
172+ echo " Run: git checkout $expectedTag "
173+ exit 1
174+ fi
170175fi
171176
172177# Setup workspace
420425 echo -e " verdict: ${RED} $verdict ${NC} "
421426 echo " "
422427 echo " Differences (excluding META-INF):"
423- echo " $diff_output " | head -30
428+ { echo " $diff_output " | head -30; } || true
424429 [[ $( echo " $diff_output " | wc -l) -gt 30 ]] && echo " ... (truncated, see $workDir /)"
425430 exitCode=1
426431fi
0 commit comments