Skip to content

Commit 9453686

Browse files
committed
v0.2.2 — test deploy script
1 parent 1fa65b5 commit 9453686

File tree

3 files changed

+85
-2
lines changed

3 files changed

+85
-2
lines changed

deploy.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
cd "$(dirname "${BASH_SOURCE[0]}")"
5+
6+
# ── Get current version ────────────────────────────────────────────
7+
CURRENT=$(grep '^version' pyproject.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
8+
MAJOR=$(echo "$CURRENT" | cut -d. -f1)
9+
MINOR=$(echo "$CURRENT" | cut -d. -f2)
10+
PATCH=$(echo "$CURRENT" | cut -d. -f3)
11+
12+
# ── Auto-increment options ─────────────────────────────────────────
13+
NEXT_PATCH="$MAJOR.$MINOR.$((PATCH + 1))"
14+
NEXT_MINOR="$MAJOR.$((MINOR + 1)).0"
15+
NEXT_MAJOR="$((MAJOR + 1)).0.0"
16+
17+
echo "Current version: $CURRENT"
18+
echo ""
19+
echo " 1) patch → $NEXT_PATCH (bug fixes, small changes)"
20+
echo " 2) minor → $NEXT_MINOR (new features, backwards compatible)"
21+
echo " 3) major → $NEXT_MAJOR (breaking changes)"
22+
echo " 4) custom"
23+
echo ""
24+
read -rp "Bump type [1]: " CHOICE
25+
CHOICE=${CHOICE:-1}
26+
27+
case "$CHOICE" in
28+
1|patch) NEW_VERSION="$NEXT_PATCH" ;;
29+
2|minor) NEW_VERSION="$NEXT_MINOR" ;;
30+
3|major) NEW_VERSION="$NEXT_MAJOR" ;;
31+
4|custom)
32+
read -rp "Version: " NEW_VERSION
33+
if [[ -z "$NEW_VERSION" ]]; then
34+
echo "No version provided. Aborting."
35+
exit 1
36+
fi
37+
;;
38+
*) echo "Invalid choice. Aborting."; exit 1 ;;
39+
esac
40+
41+
# ── Ask for description ────────────────────────────────────────────
42+
read -rp "Short description: " DESCRIPTION
43+
if [[ -z "$DESCRIPTION" ]]; then
44+
DESCRIPTION="release v$NEW_VERSION"
45+
fi
46+
47+
# ── Bump version in both files ─────────────────────────────────────
48+
echo ""
49+
echo "Bumping $CURRENT$NEW_VERSION..."
50+
sed -i "s/^version = \"$CURRENT\"/version = \"$NEW_VERSION\"/" pyproject.toml
51+
sed -i "s/__version__ = \"$CURRENT\"/__version__ = \"$NEW_VERSION\"/" jhcontext/__init__.py
52+
53+
# ── Verify versions match ──────────────────────────────────────────
54+
V_TOML=$(grep '^version' pyproject.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
55+
V_INIT=$(grep '__version__' jhcontext/__init__.py | sed 's/.*"\(.*\)"/\1/')
56+
if [[ "$V_TOML" != "$NEW_VERSION" || "$V_INIT" != "$NEW_VERSION" ]]; then
57+
echo "ERROR: Version mismatch after bump (toml=$V_TOML, init=$V_INIT)"
58+
exit 1
59+
fi
60+
echo " pyproject.toml: $V_TOML"
61+
echo " __init__.py: $V_INIT"
62+
63+
# ── Run tests ──────────────────────────────────────────────────────
64+
echo "Running tests..."
65+
python -m pytest tests/ --ignore=tests/test_example.py -q || {
66+
echo "Tests failed. Fix before releasing."
67+
git checkout -- pyproject.toml jhcontext/__init__.py
68+
exit 1
69+
}
70+
71+
# ── Git commit + tag + push ────────────────────────────────────────
72+
# Pushing the tag triggers GitHub Actions → build → upload to PyPI
73+
echo "Committing and tagging..."
74+
git add -A
75+
git commit -m "v$NEW_VERSION$DESCRIPTION"
76+
git tag "v$NEW_VERSION"
77+
git push origin main --tags
78+
79+
echo ""
80+
echo "=== v$NEW_VERSION pushed ==="
81+
echo " GitHub Actions will build and publish to PyPI automatically."
82+
echo " Watch: https://github.com/jhcontext/jhcontext-sdk/actions"
83+
echo " PyPI: https://pypi.org/project/jhcontext/$NEW_VERSION/ (after CI completes)"

jhcontext/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from .canonicalize import canonicalize
3939
from .semantics import observation, interpretation, situation, userml_payload
4040

41-
__version__ = "0.2.1"
41+
__version__ = "0.2.2"
4242

4343
__all__ = [
4444
# Models

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "jhcontext"
7-
version = "0.2.1"
7+
version = "0.2.2"
88
description = "PAC-AI: Protocol for Auditable Context in AI — Python SDK"
99
requires-python = ">=3.10"
1010
license = "Apache-2.0"

0 commit comments

Comments
 (0)