chore: add release script and make target
Usage: make release VERSION=0.8.0 Bumps Cargo.toml + Cargo.lock, commits, tags, pushes — triggers the existing GitHub Actions release workflow. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
8
Makefile
8
Makefile
@@ -1,4 +1,4 @@
|
|||||||
.PHONY: all build lint fmt check audit test coverage bench clean deploy blog
|
.PHONY: all build lint fmt check audit test coverage bench clean deploy blog release
|
||||||
|
|
||||||
all: lint build test
|
all: lint build test
|
||||||
|
|
||||||
@@ -33,6 +33,12 @@ blog:
|
|||||||
echo " $$f → site/blog/posts/$$name.html"; \
|
echo " $$f → site/blog/posts/$$name.html"; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
release:
|
||||||
|
ifndef VERSION
|
||||||
|
$(error Usage: make release VERSION=0.8.0)
|
||||||
|
endif
|
||||||
|
./scripts/release.sh $(VERSION)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
cargo clean
|
cargo clean
|
||||||
|
|
||||||
|
|||||||
43
scripts/release.sh
Executable file
43
scripts/release.sh
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
echo "Usage: $0 <version> (e.g. 0.7.0)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
VERSION="$1"
|
||||||
|
TAG="v$VERSION"
|
||||||
|
|
||||||
|
# Sanity checks
|
||||||
|
if ! git diff --quiet || ! git diff --cached --quiet; then
|
||||||
|
echo "ERROR: working tree is dirty — commit or stash first" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(git branch --show-current)" != "main" ]; then
|
||||||
|
echo "ERROR: must be on main branch" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if git tag -l "$TAG" | grep -q .; then
|
||||||
|
echo "ERROR: tag $TAG already exists" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CURRENT=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
|
||||||
|
echo "Bumping $CURRENT -> $VERSION"
|
||||||
|
|
||||||
|
# Bump version
|
||||||
|
sed -i.bak "s/^version = \"$CURRENT\"/version = \"$VERSION\"/" Cargo.toml
|
||||||
|
rm -f Cargo.toml.bak
|
||||||
|
cargo update --workspace
|
||||||
|
|
||||||
|
# Commit, tag, push
|
||||||
|
git add Cargo.toml Cargo.lock
|
||||||
|
git commit -m "chore: bump version to $VERSION"
|
||||||
|
git tag "$TAG"
|
||||||
|
git push origin main --tags
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Released $TAG — GitHub Actions will build, publish to crates.io, and create the release."
|
||||||
Reference in New Issue
Block a user