Skip to content

Commit 562039d

Browse files
committed
bump, test, publish scripts
1 parent fae9c6a commit 562039d

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed

bump.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [ -z "$1" ]; then
6+
echo "Usage: ./bump.sh <new_version>"
7+
echo "Example: ./bump.sh 0.0.3"
8+
exit 1
9+
fi
10+
11+
NEW_VERSION=$1
12+
13+
echo "Bumping version to $NEW_VERSION..."
14+
15+
# Update config.json
16+
jq ".packageVersion = \"$NEW_VERSION\"" config.json > config.json.tmp && mv config.json.tmp config.json
17+
echo "✓ Updated config.json packageVersion to $NEW_VERSION"
18+
19+
# Update Cargo.toml
20+
sed -i "s/^version = \"[^\"]*\"/version = \"$NEW_VERSION\"/" Cargo.toml
21+
echo "✓ Updated Cargo.toml version to $NEW_VERSION"
22+
23+
echo "Done! Version bumped to $NEW_VERSION"

publish.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Get version from Cargo.toml
6+
VERSION=$(grep "^version = " Cargo.toml | head -1 | cut -d'"' -f2)
7+
8+
echo "Publishing FastComments Rust SDK v$VERSION..."
9+
10+
# Verify config.json matches
11+
CONFIG_VERSION=$(jq -r '.packageVersion' config.json)
12+
if [ "$CONFIG_VERSION" != "$VERSION" ]; then
13+
echo "Error: Version mismatch!"
14+
echo "config.json has version $CONFIG_VERSION but Cargo.toml has version $VERSION"
15+
echo "Run ./bump.sh $VERSION to fix this."
16+
exit 1
17+
fi
18+
19+
# Run tests
20+
echo "Running tests..."
21+
cargo test
22+
23+
# Run checks
24+
echo "Running cargo check..."
25+
cargo check
26+
27+
# Build the package
28+
echo "Building the package..."
29+
cargo build --release
30+
31+
echo ""
32+
echo "Publishing to crates.io..."
33+
cargo publish
34+
35+
echo ""
36+
echo "✓ Successfully published fastcomments-sdk v$VERSION to crates.io!"
37+
echo ""
38+
echo "Users can now install it with:"
39+
echo " cargo add fastcomments-sdk"

test.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
echo "Running FastComments Rust SDK tests..."
6+
7+
# Run all tests
8+
echo "Running tests..."
9+
cargo test --verbose
10+
11+
echo ""
12+
echo "Running doc tests..."
13+
cargo test --doc
14+
15+
echo ""
16+
echo "✓ All tests passed!"

0 commit comments

Comments
 (0)