aboutsummaryrefslogtreecommitdiff
path: root/release.sh
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2026-01-20 15:06:22 +0000
committerdiogo464 <[email protected]>2026-01-20 15:06:22 +0000
commit8466e8720856786833099580931e7cc77d89d122 (patch)
tree7bed3c9418c9765fa536ac4e1893c7dd903d394a /release.sh
parent71f6b71cbce82c398bfacb515cd61e32476232c1 (diff)
added release scriptHEADmain
Diffstat (limited to 'release.sh')
-rwxr-xr-xrelease.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/release.sh b/release.sh
new file mode 100755
index 0000000..e79aa17
--- /dev/null
+++ b/release.sh
@@ -0,0 +1,59 @@
1#!/bin/bash
2set -euo pipefail
3
4VERSION="${1:-}"
5
6if [[ -z "$VERSION" ]]; then
7 echo "Usage: $0 <version>"
8 echo "Example: $0 0.3.0"
9 exit 1
10fi
11
12if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
13 echo "Error: Version must be in format x.y.z"
14 exit 1
15fi
16
17echo "Releasing version $VERSION"
18
19# Verify clean working directory
20if [[ -n "$(git status --porcelain)" ]]; then
21 echo "Error: Working directory has uncommitted changes"
22 git status --short
23 exit 1
24fi
25
26echo "Running pre-release checks..."
27
28echo " cargo fmt --check"
29cargo fmt --check
30
31echo " cargo clippy"
32cargo clippy -- -D warnings
33
34echo " cargo check --tests --examples"
35cargo check --tests --examples
36
37echo " cargo test"
38cargo test
39
40echo " cargo publish --dry-run"
41cargo publish --dry-run
42
43echo "All checks passed. Updating version..."
44
45sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
46
47echo "Creating commit..."
48git add Cargo.toml
49git commit -m "chore: release v$VERSION"
50
51echo "Creating tag..."
52git tag -a "v$VERSION" -m "v$VERSION"
53
54echo "Pushing to remote..."
55git push
56git push --tags
57
58echo "Release v$VERSION complete!"
59echo "To publish to crates.io, run: cargo publish"