diff options
| author | diogo464 <[email protected]> | 2026-01-20 15:06:22 +0000 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2026-01-20 15:06:22 +0000 |
| commit | 8466e8720856786833099580931e7cc77d89d122 (patch) | |
| tree | 7bed3c9418c9765fa536ac4e1893c7dd903d394a | |
| parent | 71f6b71cbce82c398bfacb515cd61e32476232c1 (diff) | |
| -rwxr-xr-x | release.sh | 59 |
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 | ||
| 2 | set -euo pipefail | ||
| 3 | |||
| 4 | VERSION="${1:-}" | ||
| 5 | |||
| 6 | if [[ -z "$VERSION" ]]; then | ||
| 7 | echo "Usage: $0 <version>" | ||
| 8 | echo "Example: $0 0.3.0" | ||
| 9 | exit 1 | ||
| 10 | fi | ||
| 11 | |||
| 12 | if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
| 13 | echo "Error: Version must be in format x.y.z" | ||
| 14 | exit 1 | ||
| 15 | fi | ||
| 16 | |||
| 17 | echo "Releasing version $VERSION" | ||
| 18 | |||
| 19 | # Verify clean working directory | ||
| 20 | if [[ -n "$(git status --porcelain)" ]]; then | ||
| 21 | echo "Error: Working directory has uncommitted changes" | ||
| 22 | git status --short | ||
| 23 | exit 1 | ||
| 24 | fi | ||
| 25 | |||
| 26 | echo "Running pre-release checks..." | ||
| 27 | |||
| 28 | echo " cargo fmt --check" | ||
| 29 | cargo fmt --check | ||
| 30 | |||
| 31 | echo " cargo clippy" | ||
| 32 | cargo clippy -- -D warnings | ||
| 33 | |||
| 34 | echo " cargo check --tests --examples" | ||
| 35 | cargo check --tests --examples | ||
| 36 | |||
| 37 | echo " cargo test" | ||
| 38 | cargo test | ||
| 39 | |||
| 40 | echo " cargo publish --dry-run" | ||
| 41 | cargo publish --dry-run | ||
| 42 | |||
| 43 | echo "All checks passed. Updating version..." | ||
| 44 | |||
| 45 | sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml | ||
| 46 | |||
| 47 | echo "Creating commit..." | ||
| 48 | git add Cargo.toml | ||
| 49 | git commit -m "chore: release v$VERSION" | ||
| 50 | |||
| 51 | echo "Creating tag..." | ||
| 52 | git tag -a "v$VERSION" -m "v$VERSION" | ||
| 53 | |||
| 54 | echo "Pushing to remote..." | ||
| 55 | git push | ||
| 56 | git push --tags | ||
| 57 | |||
| 58 | echo "Release v$VERSION complete!" | ||
| 59 | echo "To publish to crates.io, run: cargo publish" | ||
