Skip to content

Commit f166e98

Browse files
authored
Merge pull request #4 from CHINMAYVIVEK/dev
publish added
2 parents f4d2658 + b280ff2 commit f166e98

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,11 @@ path = "examples/time_conversion.rs"
4343
[[example]]
4444
name = "planetary_positions"
4545
path = "examples/planetary_positions.rs"
46+
47+
[package]
48+
exclude = [
49+
"assets/linux_m13000p17000.441.bsp",
50+
"assets/header.441",
51+
"assets/Initial_data.dat"
52+
"assets/testpo.441"
53+
]

publish.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env bash
2+
3+
# =====================================================
4+
# rust-jpl crate publish automation
5+
# Author: Chinmay Vivek
6+
# Purpose: Automate pre-checks and publish to crates.io
7+
# =====================================================
8+
9+
set -e # exit on any error
10+
set -o pipefail
11+
12+
# --- Config ---
13+
MIN_RUST_VERSION="1.70.0"
14+
CRATE_NAME="rust-jpl"
15+
16+
echo "🚀 Starting publish process for $CRATE_NAME..."
17+
18+
# --- 1. Check Rust version ---
19+
RUST_VERSION=$(rustc --version | awk '{print $2}')
20+
echo "Detected Rust version: $RUST_VERSION"
21+
22+
if [ "$(printf '%s\n' "$MIN_RUST_VERSION" "$RUST_VERSION" | sort -V | head -n1)" != "$MIN_RUST_VERSION" ]; then
23+
echo "⚠️ Rust version must be >= $MIN_RUST_VERSION"
24+
exit 1
25+
fi
26+
27+
# --- 2. Ensure Git repo is clean ---
28+
if [ -n "$(git status --porcelain)" ]; then
29+
echo "⚠️ Git repository is not clean. Commit or stash changes first."
30+
git status
31+
exit 1
32+
fi
33+
34+
# --- 3. Run formatting and linting ---
35+
echo "🔧 Running cargo fmt..."
36+
cargo fmt --all -- --check
37+
38+
echo "🔍 Running cargo clippy..."
39+
cargo clippy --all-targets --all-features -- -D warnings
40+
41+
# --- 4. Run tests ---
42+
echo "🧪 Running tests..."
43+
cargo test --all
44+
45+
# --- 5. Build docs ---
46+
echo "📚 Building documentation..."
47+
cargo doc --no-deps
48+
49+
# --- 6. Check package ---
50+
echo "📦 Verifying package contents (dry run)..."
51+
cargo package --allow-dirty --no-verify --dry-run
52+
53+
# --- 7. Confirm publish ---
54+
read -p "✅ All checks passed. Proceed to publish $CRATE_NAME to crates.io? [y/N]: " CONFIRM
55+
CONFIRM=${CONFIRM,,} # convert to lowercase
56+
if [[ "$CONFIRM" != "y" ]]; then
57+
echo "❌ Publish aborted."
58+
exit 0
59+
fi
60+
61+
# --- 8. Publish ---
62+
echo "🚀 Publishing $CRATE_NAME to crates.io..."
63+
cargo publish
64+
65+
echo "🎉 Publish completed successfully!"

0 commit comments

Comments
 (0)