Skip to content

Commit 0b5df9b

Browse files
committed
fix: resolve cargo package dirty working directory issue in workflows
1 parent 00f018e commit 0b5df9b

File tree

3 files changed

+30
-28
lines changed

3 files changed

+30
-28
lines changed

.github/workflows/publish-test.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ jobs:
4747
run: |
4848
echo "Validating Cargo.toml metadata for crates.io..."
4949
50-
# Check required fields are present
51-
cargo metadata --format-version 1 --no-deps | jq -r '.packages[0]' > package.json
50+
# Check required fields are present using a temporary file
51+
cargo metadata --format-version 1 --no-deps | jq -r '.packages[0]' > /tmp/package.json
5252
5353
# Verify required fields
5454
required_fields=("description" "license" "repository" "authors")
5555
for field in "${required_fields[@]}"; do
56-
value=$(jq -r ".$field" package.json)
56+
value=$(jq -r ".$field" /tmp/package.json)
5757
if [ "$value" == "null" ] || [ -z "$value" ]; then
5858
echo "❌ Missing required field: $field"
5959
exit 1
@@ -62,13 +62,16 @@ jobs:
6262
fi
6363
done
6464
65+
# Clean up temporary file
66+
rm -f /tmp/package.json
67+
6568
echo "✅ All required metadata fields are present"
6669
6770
# Step 5: Test packaging (all examples without git dependencies)
6871
- name: Test package
6972
run: |
7073
echo "Testing package for crates.io publishing..."
71-
cargo package --verbose
74+
cargo package --verbose --allow-dirty
7275
echo "✅ Package builds successfully and is ready for crates.io"
7376
7477
# Step 6: Verify example binaries can build

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,15 @@ jobs:
236236
run: |
237237
echo "Verifying package for crates.io publishing..."
238238
echo "Package contains educational examples without git dependencies"
239-
cargo package --verbose
240-
cargo package --list
239+
cargo package --verbose --allow-dirty
240+
cargo package --list --allow-dirty
241241
242242
# Step 5: Publish to crates.io
243243
- name: Publish to crates.io
244244
run: |
245245
echo "Publishing MCP Rust Examples to crates.io..."
246246
echo "📦 Publishing educational Rust examples for the MCP community"
247-
cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} --verbose
247+
cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} --verbose --allow-dirty
248248
env:
249249
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
250250

README.md

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ We've created two distinct learning paths to serve different audiences and learn
9393
mcp_rust_examples = "0.1.0"
9494

9595
# Or install binaries globally
96-
cargo install mcp_rust_examples --features examples-only
96+
cargo install mcp_rust_examples
9797

9898
# Run examples directly
9999
example_01_hello_world
@@ -207,41 +207,40 @@ mcp-rust-tutorial/
207207

208208
---
209209

210-
## 🔧 **Feature Flags**
211-
212-
This crate supports multiple feature configurations for different use cases:
210+
## 🔧 **Installation Options**
213211

214-
**Default Features:**
215-
```toml
216-
[dependencies]
217-
mcp_rust_examples = "0.1.0" # Includes MCP SDK (development branch)
218-
```
212+
This crate provides educational Rust examples for MCP development:
219213

220-
**Examples-Only Mode (Recommended for crates.io):**
214+
**Simple Installation:**
221215
```toml
222216
[dependencies]
223-
mcp_rust_examples = { version = "0.1.0", features = ["examples-only"], default-features = false }
217+
mcp_rust_examples = "0.1.0" # Educational examples with all dependencies
224218
```
225219

226-
**Available Features:**
227-
- `default` = `["mcp"]` - Full MCP SDK integration
228-
- `mcp` - Enable MCP protocol support (requires git dependency)
229-
- `examples-only` - Just the educational code and examples
230-
231-
**Installation Commands:**
220+
**Global Binary Installation:**
232221
```bash
233-
# With full MCP support (from git)
222+
# Install all example binaries globally
234223
cargo install mcp_rust_examples
235224

236-
# Examples only (from crates.io)
237-
cargo install mcp_rust_examples --features examples-only --no-default-features
225+
# Run any example
226+
example_01_hello_world
227+
example_13_auth_service
228+
example_20_enterprise_server
229+
```
238230

239-
# For development
231+
**Development Setup:**
232+
```bash
233+
# For development and extending examples
240234
git clone https://github.com/RustSandbox/MCP-Development-with-Rust
241235
cd MCP-Development-with-Rust
242236
cargo build --all
237+
238+
# Run examples locally
239+
cargo run --bin example_01_hello_world
243240
```
244241

242+
**Note:** For full MCP SDK integration in your own projects, see the [official rmcp documentation](https://hackmd.io/@Hamze/S1tlKZP0kx).
243+
245244
## 🛠️ **Development Commands**
246245

247246
We provide a comprehensive development environment with 50+ commands via [just](https://github.com/casey/just):

0 commit comments

Comments
 (0)