From 110b831b27dc1ad5f72763fbb0bd4ac7d5b3db26 Mon Sep 17 00:00:00 2001 From: projectdx Date: Sun, 11 Jan 2026 20:28:24 +0900 Subject: [PATCH] test: trigger hook bump #2 --- pubspec.yaml | 2 +- scripts/bump_patch_version.sh | 57 +++++++++++++---------------------- 2 files changed, 22 insertions(+), 37 deletions(-) mode change 100644 => 100755 scripts/bump_patch_version.sh diff --git a/pubspec.yaml b/pubspec.yaml index 18b6610..a249ac1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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" diff --git a/scripts/bump_patch_version.sh b/scripts/bump_patch_version.sh old mode 100644 new mode 100755 index 5d87733..43e9e9e --- a/scripts/bump_patch_version.sh +++ b/scripts/bump_patch_version.sh @@ -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" \ No newline at end of file +exit 0 \ No newline at end of file