Commit publish-crates script (#52)

* Script for publishing crates to crates.io

* Added sdk to the publish-crates script, renamed client-sdk to sdk

* Updated Cargo.lock and added 2 crates to the upgrade version script

* Small fix

* Actual fix

* Updated client API messages crate to be publishable

* Added LICENSE file to sdk

* Chose specific version for tokio-tungstenite

---------

Co-authored-by: Boppy <no-reply@boppygames.gg>
Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com>
This commit is contained in:
John Detter
2023-07-03 20:51:32 -05:00
committed by Tyler Cloutier
parent e35f5c4bda
commit 8bc2391ddc
17 changed files with 94 additions and 28 deletions
Generated
+20 -20
View File
@@ -4000,32 +4000,13 @@ dependencies = [
[[package]]
name = "spacetimedb-client-api-messages"
version = "0.1.0"
version = "0.5.0"
dependencies = [
"prost",
"prost-build",
"strum",
]
[[package]]
name = "spacetimedb-client-sdk"
version = "0.5.0"
dependencies = [
"anyhow",
"anymap",
"futures",
"futures-channel",
"http",
"im",
"log",
"prost",
"spacetimedb-client-api-messages",
"spacetimedb-lib",
"spacetimedb-sats",
"tokio",
"tokio-tungstenite 0.19.0",
]
[[package]]
name = "spacetimedb-core"
version = "0.5.0"
@@ -4147,6 +4128,25 @@ dependencies = [
"thiserror",
]
[[package]]
name = "spacetimedb-sdk"
version = "0.5.0"
dependencies = [
"anyhow",
"anymap",
"futures",
"futures-channel",
"http",
"im",
"log",
"prost",
"spacetimedb-client-api-messages",
"spacetimedb-lib",
"spacetimedb-sats",
"tokio",
"tokio-tungstenite 0.19.0",
]
[[package]]
name = "spacetimedb-standalone"
version = "0.5.0"
+1 -1
View File
@@ -13,7 +13,7 @@ members = [
"crates/vm",
"crates/replay",
"crates/client-api",
"crates/client-sdk",
"crates/sdk",
"crates/client-api-messages",
"crates/sqltest",
"modules/rust-wasm-test",
+3 -1
View File
@@ -1,7 +1,9 @@
[package]
name = "spacetimedb-client-api-messages"
version = "0.1.0"
version = "0.5.0"
edition = "2021"
license-file = "LICENSE"
description = "Types for the SpacetimeDB client API messages"
[dependencies]
strum = { version = "0.24.1", features = ["derive"] }
View File
@@ -1,15 +1,17 @@
[package]
name = "spacetimedb-client-sdk"
name = "spacetimedb-sdk"
version = "0.5.0"
edition = "2021"
license-file = "LICENSE"
description = "A Rust SDK for clients to interface with SpacetimeDB"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
spacetimedb-sats = { path = "../sats" }
spacetimedb-lib = { path = "../lib" }
spacetimedb-client-api-messages = { path = "../client-api-messages" }
tokio-tungstenite = { version = "*", features = ["native-tls"] }
spacetimedb-sats = { path = "../sats", version = "0.5.0" }
spacetimedb-lib = { path = "../lib", version = "0.5.0" }
spacetimedb-client-api-messages = { path = "../client-api-messages", version = "0.5.0" }
tokio-tungstenite = { version = "0.19", features = ["native-tls"] }
tokio = { version = "1.2", features = ["full"] }
http = "0.2"
anyhow = "1.0"
View File
+62
View File
@@ -0,0 +1,62 @@
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")/.."
DRY_RUN=0
if [ "$#" != "0" ]; then
if [ "$1" != "--dry-run" ]; then
echo "$1 is not a valid flag";
exit 1;
else
DRY_RUN=1
fi
fi
if [ $DRY_RUN != 1 ] ; then
echo "You are about to publish to crates.io (dry run is false.)"
echo "We are also going to do a test install after publishing. This will remove any version of spacetimedb-cli you may have installed."
echo
echo "Press [Enter] to continue."
read -r
fi
BASEDIR=$(pwd)
FIRST_CRATE=1
declare -a CRATES=("bindings-macro" "bindings-sys" "sats" "lib" "bindings" "cli" "client-api-messages" "sdk")
for crate in "${CRATES[@]}" ; do
if [ ! -d "${BASEDIR}/crates/${crate}" ] ; then
echo "This crate does not exist: ${crate}"
exit 1
fi
done
for crate in "${CRATES[@]}" ; do
if [ $FIRST_CRATE != 1 ] ; then
echo "Waiting 60 seconds for crates.io to update..."
sleep 60
fi
cd "${BASEDIR}/crates/${crate}"
if [ $DRY_RUN == 1 ] ; then
cargo publish --dry-run
else
cargo publish
fi
FIRST_CRATE=0
done
echo "Doing a test install."
set +e
cargo uninstall spacetimedb-cli > /dev/null
set -e
echo
if cargo install spacetimedb-cli ; then
echo "Installation was successful. Congrats on publishing to crates.io!"
else
echo "ERROR: Installation failed! Check the build log for details. This typically means you forgot to update the version of a dependency."
fi
+1 -1
View File
@@ -17,7 +17,7 @@ fsed() {
}
version="$1"
declare -a crates=("bench" "bindings" "bindings-macro" "bindings-sys" "client-api-messages" "cli" "client-api" "core" "lib" "sats" "standalone" "testing")
declare -a crates=("bench" "bindings" "bindings-macro" "bindings-sys" "client-api-messages" "cli" "client-api" "core" "lib" "sats" "standalone" "testing" "client-api-messages" "sdk")
upgrade_version() {
toml=crates/$1/Cargo.toml
if [ ! -f "$toml" ] ; then