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." description: "A high-performance media player like nPlayer."
publish_to: "none" publish_to: "none"
version: 1.0.1+1 version: 1.0.2+1
environment: environment:
sdk: ">=3.3.3 <4.0.0" 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 exit 0
fi fi
# Read version line # Use a short Python helper for robust YAML-safe replacement
ver_line=$(grep -E '^version:\s*' "$PUBSPEC" || true) python3 - <<'PY'
if [[ -z "$ver_line" ]]; then import re
echo "No version line found in $PUBSPEC; skipping" from pathlib import Path
exit 0 p = Path('pubspec.yaml')
fi s = p.read_text()
# find first version: line
# Extract version string (e.g., 1.2.3 or 1.2.3+4) m = re.search(r"^([ \t]*version:\s*)([0-9]+)\.([0-9]+)\.([0-9]+)(\+[0-9]+)?\s*$", s, re.M)
if [[ "$ver_line" =~ ([0-9]+)\.([0-9]+)\.([0-9]+)(\+[0-9]+)? ]]; then if not m:
major=${BASH_REMATCH[1]} print('No parsable version line found; skipping')
minor=${BASH_REMATCH[2]} raise SystemExit(0)
patch=${BASH_REMATCH[3]} prefix = m.group(1)
build=${BASH_REMATCH[4]:-} major = int(m.group(2)); minor = int(m.group(3)); patch = int(m.group(4)); build = m.group(5) or ''
else new_patch = patch + 1
echo "Failed to parse version from: $ver_line" newver = f"{major}.{minor}.{new_patch}{build}"
exit 0 new_line = prefix + newver
fi s2 = s[:m.start()] + new_line + s[m.end():]
p.write_text(s2)
newpatch=$((patch + 1)) print('pubspec version bumped to', newver)
if [[ -n "$build" ]]; then PY
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"
# Stage the change so it is included in the commit # Stage the change so it is included in the commit
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
git add "$PUBSPEC" || true git add "$PUBSPEC" || true
fi fi
echo "pubspec version bumped to $newver" exit 0