test: trigger hook bump #2

This commit is contained in:
2026-01-11 20:28:24 +09:00
parent 67b4bb89db
commit 110b831b27
2 changed files with 22 additions and 37 deletions

View File

@@ -2,7 +2,7 @@ name: yommi_ff
description: "A high-performance media player like nPlayer."
publish_to: "none"
version: 1.0.1+1
version: 1.0.2+1
environment:
sdk: ">=3.3.3 <4.0.0"

57
scripts/bump_patch_version.sh Normal file → Executable file
View File

@@ -7,45 +7,30 @@ if [[ ! -f "$PUBSPEC" ]]; then
exit 0
fi
# Read version line
ver_line=$(grep -E '^version:\s*' "$PUBSPEC" || true)
if [[ -z "$ver_line" ]]; then
echo "No version line found in $PUBSPEC; skipping"
exit 0
fi
# Extract version string (e.g., 1.2.3 or 1.2.3+4)
if [[ "$ver_line" =~ ([0-9]+)\.([0-9]+)\.([0-9]+)(\+[0-9]+)? ]]; then
major=${BASH_REMATCH[1]}
minor=${BASH_REMATCH[2]}
patch=${BASH_REMATCH[3]}
build=${BASH_REMATCH[4]:-}
else
echo "Failed to parse version from: $ver_line"
exit 0
fi
newpatch=$((patch + 1))
if [[ -n "$build" ]]; then
newver="${major}.${minor}.${newpatch}${build}"
else
newver="${major}.${minor}.${newpatch}"
fi
# Replace the first 'version:' line with the new version preserving leading whitespace
tmpfile=$(mktemp)
awk -v newver="$newver" 'BEGIN{re="^[[:space:]]*version:[[:space:]]*"} { if($0 ~ re && !done){ sub(re, substr($0,1,index($0,":"))+"version: " newver); done=1 } print }' "$PUBSPEC" > "$tmpfile"
# Fallback: simpler replace if awk didn't work
if ! grep -q "version: $newver" "$tmpfile"; then
sed -E "0,/^([[:space:]]*)version:/s//\1version: $newver/" "$PUBSPEC" > "$tmpfile"
fi
# Move replacement into place
mv "$tmpfile" "$PUBSPEC"
# Use a short Python helper for robust YAML-safe replacement
python3 - <<'PY'
import re
from pathlib import Path
p = Path('pubspec.yaml')
s = p.read_text()
# find first version: line
m = re.search(r"^([ \t]*version:\s*)([0-9]+)\.([0-9]+)\.([0-9]+)(\+[0-9]+)?\s*$", s, re.M)
if not m:
print('No parsable version line found; skipping')
raise SystemExit(0)
prefix = m.group(1)
major = int(m.group(2)); minor = int(m.group(3)); patch = int(m.group(4)); build = m.group(5) or ''
new_patch = patch + 1
newver = f"{major}.{minor}.{new_patch}{build}"
new_line = prefix + newver
s2 = s[:m.start()] + new_line + s[m.end():]
p.write_text(s2)
print('pubspec version bumped to', newver)
PY
# Stage the change so it is included in the commit
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
git add "$PUBSPEC" || true
fi
echo "pubspec version bumped to $newver"
exit 0