-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d130b95
commit 9dff39c
Showing
1 changed file
with
19 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
#!/bin/bash | ||
|
||
## How to run | ||
## `./upgrade.sh from to` | ||
## | ||
## such as: | ||
## `./upgrade.sh 0.3.1 0.3.2` | ||
## `./upgrade.sh` | ||
|
||
if [ "$#" -ne 2 ] | ||
then | ||
echo "Arguments are not equals to 2\n" | ||
echo "./upgrade.sh from to" | ||
exit 1 | ||
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c | ||
# Usage | ||
# $ get_latest_release "duckdb/duckdb" | ||
get_latest_release() { | ||
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | ||
grep '"tag_name":' | # Get tag line | ||
sed -E 's/.*"v([^"]+)".*/\1/' # Pluck JSON value | ||
} | ||
|
||
duckdb_version=$(get_latest_release "duckdb/duckdb") | ||
duckdb_rs_version=$(get_latest_release "duckdb/duckdb-rs") | ||
|
||
if [ $duckdb_version = $duckdb_rs_version ]; then | ||
echo "Already update to date, latest version is $duckdb_version" | ||
exit 0 | ||
fi | ||
|
||
sed -i '' "s/$1/$2/g" Cargo.toml libduckdb-sys/upgrade.sh libduckdb-sys/Cargo.toml .github/workflows/rust.yaml | ||
echo "Start to upgrade from $duckdb_version to $duckdb_rs_version" | ||
|
||
sed -i '' "s/$duckdb_rs_version/$duckdb_version/g" Cargo.toml libduckdb-sys/upgrade.sh libduckdb-sys/Cargo.toml .github/workflows/rust.yaml | ||
./libduckdb-sys/upgrade.sh |