| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
cd "$(dirname "$0")/.." |
| 6 |
|
| 7 |
CURRENT_VERSION=$(grep '#define SQLITE_VERSION_NUMBER' sqlite3-binding.c | grep -o '[0-9]\{7\}') |
| 8 |
|
| 9 |
go run upgrade/upgrade.go |
| 10 |
VERSION=$(grep '#define SQLITE_VERSION_NUMBER' sqlite3-binding.c | grep -o '[0-9]\{7\}') |
| 11 |
|
| 12 |
if [ -z "$VERSION" ]; then |
| 13 |
echo "Error: Could not extract SQLite version" |
| 14 |
exit 1 |
| 15 |
fi |
| 16 |
|
| 17 |
if [ "$VERSION" = "$CURRENT_VERSION" ]; then |
| 18 |
echo "Already up to date: version $VERSION" |
| 19 |
git checkout -- sqlite3-binding.c sqlite3-binding.h sqlite3ext.h |
| 20 |
exit 0 |
| 21 |
fi |
| 22 |
|
| 23 |
git branch -d "sqlite-amalgamation-$VERSION" 2>/dev/null || true |
| 24 |
git checkout -b "sqlite-amalgamation-$VERSION" |
| 25 |
git commit -m "Upgrade SQLite to version $VERSION" sqlite3-binding.c sqlite3-binding.h sqlite3ext.h |
| 26 |
git push origin HEAD |
| 27 |
|
| 28 |
MAJOR=$(echo $VERSION | cut -c1) |
| 29 |
MINOR=$(echo $VERSION | cut -c2-4 | sed 's/^0*\([0-9]\)/\1/') |
| 30 |
PATCH=$(echo $VERSION | cut -c5-7 | sed 's/^0*\([0-9]\)/\1/') |
| 31 |
CHANGELOG_URL="https://www.sqlite.org/releaselog/${MAJOR}_${MINOR}_${PATCH}.html" |
| 32 |
|
| 33 |
gh pr create --title "Upgrade SQLite to version $VERSION" --body "Automated SQLite upgrade to version $VERSION |
| 34 |
|
| 35 |
## Changelog |
| 36 |
See: $CHANGELOG_URL" --web |