Skip to content

Commit 92f19c2

Browse files
committed
release script
1 parent 3ee307c commit 92f19c2

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

scripts/release.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Check if version type is provided
5+
if [ -z "$1" ]; then
6+
echo "Please provide version type: major, minor, or patch"
7+
exit 1
8+
fi
9+
10+
VERSION_TYPE=$1
11+
12+
# Ensure we're on main branch
13+
current_branch=$(git branch --show-current)
14+
if [ "$current_branch" != "main" ]; then
15+
echo "Please switch to main branch first"
16+
exit 1
17+
fi
18+
19+
# Ensure working directory is clean
20+
if [ -n "$(git status --porcelain)" ]; then
21+
echo "Working directory is not clean. Please commit or stash changes first."
22+
exit 1
23+
fi
24+
25+
# Pull latest changes
26+
git pull origin main
27+
28+
# Bump version using poetry
29+
echo "Bumping $VERSION_TYPE version..."
30+
poetry version $VERSION_TYPE
31+
NEW_VERSION=$(poetry version -s)
32+
33+
# Update files
34+
git add pyproject.toml
35+
36+
# Commit version bump
37+
git commit -m "chore: bump version to ${NEW_VERSION}"
38+
39+
# Create and push tag
40+
git tag -a "v${NEW_VERSION}" -m "Release v${NEW_VERSION}"
41+
git push origin main --tags
42+
43+
# Create GitHub release
44+
echo "Creating GitHub release..."
45+
gh release create "v${NEW_VERSION}" \
46+
--title "Release v${NEW_VERSION}" \
47+
--generate-notes
48+
49+
echo "Released v${NEW_VERSION} successfully!"

0 commit comments

Comments
 (0)