Fix upgrade.sh: add already-up-to-date check and fix changelog URL format

This commit is contained in:
Yasuhiro Matsumoto
2026-03-17 01:31:18 +09:00
committed by mattn
parent 4ea2a9fb44
commit d71eda82d4

View File

@@ -4,6 +4,8 @@ set -e
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
CURRENT_VERSION=$(grep '#define SQLITE_VERSION_NUMBER' sqlite3-binding.c | grep -o '[0-9]\{7\}')
go run upgrade/upgrade.go go run upgrade/upgrade.go
VERSION=$(grep '#define SQLITE_VERSION_NUMBER' sqlite3-binding.c | grep -o '[0-9]\{7\}') VERSION=$(grep '#define SQLITE_VERSION_NUMBER' sqlite3-binding.c | grep -o '[0-9]\{7\}')
@@ -12,16 +14,21 @@ if [ -z "$VERSION" ]; then
exit 1 exit 1
fi fi
if [ "$VERSION" = "$CURRENT_VERSION" ]; then
echo "Already up to date: version $VERSION"
git checkout -- sqlite3-binding.c sqlite3-binding.h sqlite3ext.h
exit 0
fi
git branch -d "sqlite-amalgamation-$VERSION" 2>/dev/null || true git branch -d "sqlite-amalgamation-$VERSION" 2>/dev/null || true
git checkout -b "sqlite-amalgamation-$VERSION" git checkout -b "sqlite-amalgamation-$VERSION"
git commit -m "Upgrade SQLite to version $VERSION" sqlite3-binding.c sqlite3-binding.h sqlite3ext.h git commit -m "Upgrade SQLite to version $VERSION" sqlite3-binding.c sqlite3-binding.h sqlite3ext.h
git push origin HEAD git push origin HEAD
MAJOR=$(echo $VERSION | cut -c1-3) MAJOR=$(echo $VERSION | cut -c1)
MINOR=$(echo $VERSION | cut -c4-5) MINOR=$(echo $VERSION | cut -c2-4 | sed 's/^0*//')
PATCH=$(echo $VERSION | cut -c6-7) PATCH=$(echo $VERSION | cut -c5-7 | sed 's/^0*//')
VERSION_STR="${MAJOR}.${MINOR}.${PATCH}" CHANGELOG_URL="https://www.sqlite.org/releaselog/${MAJOR}_${MINOR}_${PATCH}.html"
CHANGELOG_URL="https://www.sqlite.org/releaselog/${VERSION_STR}.html"
gh pr create --title "Upgrade SQLite to version $VERSION" --body "Automated SQLite upgrade to version $VERSION gh pr create --title "Upgrade SQLite to version $VERSION" --body "Automated SQLite upgrade to version $VERSION