Skip to content

Commit c06dc59

Browse files
leavessterclaude
andcommitted
Fix version sync: use package.oo.yaml as primary source
Critical fixes: - Update package.oo.yaml from 0.1.7 to 0.1.10 (was out of sync) - Change bump-version.sh to read from package.oo.yaml instead of pyproject.toml - Update both version files atomically in single commit - Remove hardcoded version examples (0.1.9 → generic 0.1.0) This eliminates the "multiple sources of truth" anti-pattern where package.oo.yaml and pyproject.toml had different versions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent dc223a6 commit c06dc59

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

bump-version.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ NC='\033[0m' # No Color
1111
usage() {
1212
echo "Usage: $0 <patch|minor|major|version> [--yes]"
1313
echo "Examples:"
14-
echo " $0 patch # 0.1.9 → 0.1.10 (需要确认)"
15-
echo " $0 minor --yes # 0.1.9 → 0.2.0 (跳过确认)"
16-
echo " $0 major # 0.1.9 → 1.0.0"
14+
echo " $0 patch # 0.1.0 → 0.1.1 (需要确认)"
15+
echo " $0 minor --yes # 0.1.0 → 0.2.0 (跳过确认)"
16+
echo " $0 major # 0.1.0 → 1.0.0"
1717
echo " $0 0.2.5 --yes # 直接指定版本号"
1818
exit 1
1919
}
@@ -34,7 +34,8 @@ if [ $# -eq 2 ]; then
3434
usage
3535
fi
3636
fi
37-
VERSION_FILE="pyproject.toml"
37+
VERSION_FILE="package.oo.yaml"
38+
VERSION_FILE_SECONDARY="pyproject.toml"
3839

3940
# 检查工作区是否干净
4041
if [ -n "$(git status --porcelain)" ]; then
@@ -43,8 +44,8 @@ if [ -n "$(git status --porcelain)" ]; then
4344
exit 1
4445
fi
4546

46-
# 读取当前版本
47-
CURRENT_VERSION=$(grep -E '^version = ' "$VERSION_FILE" | cut -d'"' -f2)
47+
# 读取当前版本 (从 package.oo.yaml)
48+
CURRENT_VERSION=$(grep -E '^version:' "$VERSION_FILE" | awk '{print $2}')
4849

4950
if [ -z "$CURRENT_VERSION" ]; then
5051
echo -e "${RED}错误: 无法从 $VERSION_FILE 读取当前版本${NC}"
@@ -96,12 +97,16 @@ fi
9697

9798
# 1. 更新版本号
9899
echo -e "${GREEN}[1/4] 更新版本号...${NC}"
99-
sed -i.bak "s/version = \"$CURRENT_VERSION\"/version = \"$NEW_VERSION\"/" "$VERSION_FILE"
100+
# 更新 package.oo.yaml (主版本文件)
101+
sed -i.bak "s/^version: $CURRENT_VERSION$/version: $NEW_VERSION/" "$VERSION_FILE"
100102
rm -f "$VERSION_FILE.bak"
103+
# 更新 pyproject.toml (次要版本文件)
104+
sed -i.bak "s/version = \"$CURRENT_VERSION\"/version = \"$NEW_VERSION\"/" "$VERSION_FILE_SECONDARY"
105+
rm -f "$VERSION_FILE_SECONDARY.bak"
101106

102107
# 2. 提交变更
103108
echo -e "${GREEN}[2/4] 提交变更...${NC}"
104-
git add "$VERSION_FILE"
109+
git add "$VERSION_FILE" "$VERSION_FILE_SECONDARY"
105110
git commit -m "$(cat <<EOF
106111
Bump version from $CURRENT_VERSION to $NEW_VERSION
107112

package.oo.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 0.1.7
1+
version: 0.1.10
22
scripts:
33
# Script executed when the container is first loaded
44
# eg: bootstrap: poetry add pandas

0 commit comments

Comments
 (0)