Skip to content

Commit 3442c4c

Browse files
refactor and fix
1 parent a94a92c commit 3442c4c

3 files changed

Lines changed: 7 additions & 24 deletions

File tree

Taskfile.cicd.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,6 @@ tasks:
147147
}
148148
149149
current="$(task version:get 2>/dev/null || true)"
150-
if [ -z "$current" ] && [ -f .version ]; then
151-
current="$(tr -d '\n' < .version)"
152-
fi
153150
154151
case "$bump_type" in
155152
set)
@@ -176,7 +173,7 @@ tasks:
176173
;;
177174
esac
178175
179-
printf "%s" "$next" > .version
176+
printf "%s" "$next"
180177
181178
version:tag-release:
182179
desc: Create set of git tags

Taskfile.scripts.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,13 @@ tasks:
9393
- echo "{{.VERSION}}"
9494

9595
version:set:
96-
desc: Update .version file
96+
desc: Validate version
9797
cmds:
9898
- |
9999
if [ -z "{{.VERSION}}" ]; then
100100
echo "❌ ERROR: VERSION is empty"
101101
exit 1
102102
fi
103-
- echo "{{.VERSION}}" > .version
104-
105103
version:update:patch:
106104
desc: Increment patch version (e.g., 1.2.3 -> 1.2.4)
107105
cmds:

Taskfile.variables.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,15 @@ vars:
3030
fi
3131
PROJECT_DIR_NAME:
3232
sh: basename "$PWD"
33-
VERSION_FILE: .version
34-
VERSION_FROM_FILE:
35-
sh: |
36-
if [ ! -f "{{.VERSION_FILE}}" ]; then
37-
echo ""
38-
else
39-
tr -d '\n' < "{{.VERSION_FILE}}"
40-
fi
4133
VERSION_OVERRIDE:
42-
sh: echo "__TAKEN_FROM_FILE__"
34+
sh: echo "${VERSION_OVERRIDE:-}"
4335
VERSION:
4436
sh: |
45-
if [ "${VERSION_OVERRIDE}" = "__TAKEN_FROM_FILE__" ]; then
46-
from_file="{{.VERSION_FROM_FILE}}"
47-
if [ -n "$from_file" ]; then
48-
echo "$from_file"
49-
else
50-
git tag --sort=-v:refname 2>/dev/null | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1
51-
fi
37+
override="{{.VERSION_OVERRIDE}}"
38+
if [ -n "$override" ]; then
39+
echo "$override"
5240
else
53-
echo "${VERSION_OVERRIDE}"
41+
git tag --sort=-v:refname 2>/dev/null | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1
5442
fi
5543
VERSION_NO_V:
5644
sh: v="{{.VERSION}}"; echo "${v#v}"

0 commit comments

Comments
 (0)