-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpre-release.ps1
68 lines (57 loc) · 1.82 KB
/
pre-release.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Pre-release checks script for Rust libraries
Write-Host "🔍 Starting pre-release checks..." -ForegroundColor Cyan
# Function to run a command and check its exit code
function Invoke-CommandWithCheck {
param (
[string]$Message,
[scriptblock]$Command
)
Write-Host "`n► $Message" -ForegroundColor Yellow
& $Command
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ Failed: $Message" -ForegroundColor Red
exit $LASTEXITCODE
}
Write-Host "✅ Passed: $Message" -ForegroundColor Green
}
# Update dependencies
Invoke-CommandWithCheck "Updating dependencies" {
cargo update
}
# Format check
Invoke-CommandWithCheck "Running cargo fmt" {
cargo fmt --all
}
# Clippy with all features
Invoke-CommandWithCheck "Running clippy checks" {
cargo clippy --all-features -- -D warnings
}
# Run tests
Invoke-CommandWithCheck "Running tests" {
cargo test --all-features
}
# Check documentation
Invoke-CommandWithCheck "Checking documentation" {
cargo doc --no-deps --all-features
}
# Run cargo check with all features
Invoke-CommandWithCheck "Running cargo check" {
cargo check --all-features
}
# Verify the package
Invoke-CommandWithCheck "Verifying package" {
cargo package --no-verify --allow-dirty
}
# # Clean up any artifacts
# Invoke-CommandWithCheck "Cleaning up" {
# cargo clean
# }
Write-Host "`n✨ Pre-release checks completed successfully! ✨" -ForegroundColor Cyan
Write-Host "You can now proceed with publishing your release.`n"
# Show next steps
Write-Host "Next steps:" -ForegroundColor Magenta
Write-Host "1. Update version in Cargo.toml"
Write-Host "2. Commit changes: git commit -am 'Release v[VERSION]'"
Write-Host "3. Create git tag: git tag v[VERSION]"
Write-Host "4. Push changes: git push && git push --tags"
Write-Host "5. Publish to crates.io: cargo publish"