test: trigger pre-commit bump version

This commit is contained in:
2026-01-11 20:24:47 +09:00
parent e24771d552
commit 7396524bca
2 changed files with 58 additions and 0 deletions

View File

@@ -16,6 +16,9 @@ PODS:
- shared_preferences_foundation (0.0.1): - shared_preferences_foundation (0.0.1):
- Flutter - Flutter
- FlutterMacOS - FlutterMacOS
- sqflite_darwin (0.0.4):
- Flutter
- FlutterMacOS
- volume_controller (0.0.1): - volume_controller (0.0.1):
- FlutterMacOS - FlutterMacOS
- wakelock_plus (0.0.1): - wakelock_plus (0.0.1):
@@ -30,6 +33,7 @@ DEPENDENCIES:
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite_darwin (from `Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin`)
- volume_controller (from `Flutter/ephemeral/.symlinks/plugins/volume_controller/macos`) - volume_controller (from `Flutter/ephemeral/.symlinks/plugins/volume_controller/macos`)
- wakelock_plus (from `Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos`) - wakelock_plus (from `Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos`)
@@ -50,6 +54,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
shared_preferences_foundation: shared_preferences_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin
sqflite_darwin:
:path: Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin
volume_controller: volume_controller:
:path: Flutter/ephemeral/.symlinks/plugins/volume_controller/macos :path: Flutter/ephemeral/.symlinks/plugins/volume_controller/macos
wakelock_plus: wakelock_plus:
@@ -64,6 +70,7 @@ SPEC CHECKSUMS:
package_info_plus: f0052d280d17aa382b932f399edf32507174e870 package_info_plus: f0052d280d17aa382b932f399edf32507174e870
path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880 path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
volume_controller: 5c068e6d085c80dadd33fc2c918d2114b775b3dd volume_controller: 5c068e6d085c80dadd33fc2c918d2114b775b3dd
wakelock_plus: 917609be14d812ddd9e9528876538b2263aaa03b wakelock_plus: 917609be14d812ddd9e9528876538b2263aaa03b

View File

@@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -euo pipefail
PUBSPEC="pubspec.yaml"
if [[ ! -f "$PUBSPEC" ]]; then
echo "No $PUBSPEC found in $(pwd); skipping version bump"
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"
# 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"