Skip to content

Commit a5c34fe

Browse files
fix: fall back to latest git tag when .version file is missing
VERSION variable now resolves from git tags when VERSION_FROM_FILE is empty, so version:resolve-next works on fresh checkouts without a committed .version file. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3093138 commit a5c34fe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Taskfile.variables.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,12 @@ vars:
8787
VERSION:
8888
sh: |
8989
if [ "${VERSION_OVERRIDE}" = "__TAKEN_FROM_ACTION_YML__" ]; then
90-
echo "{{.VERSION_FROM_ACTION_YML}}"
90+
from_file="{{.VERSION_FROM_ACTION_YML}}"
91+
if [ -n "$from_file" ]; then
92+
echo "$from_file"
93+
else
94+
git tag --sort=-v:refname 2>/dev/null | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1
95+
fi
9196
elif [ -z "${VERSION_OVERRIDE}" ]; then
9297
echo "{{.LAST_RELEASE}}"
9398
else

0 commit comments

Comments
 (0)