Skip to content
This repository was archived by the owner on May 31, 2026. It is now read-only.

Commit d78ae3e

Browse files
groksrcclaude
andcommitted
ci(release): base bump on latest tag, revert files to 0.2.0
Two related changes after the v0.3.0 misfire: - Release workflow now reads the "current" version from the latest v*.*.* git tag, not from __init__.py. A merged PR that pre-bumped __init__.py to 0.2.0 was causing the bump logic to read 0.2.0 as "current" and then double-bump on top (minor → 0.3.0). Reading from the last tag (v0.1.7) makes minor → v0.2.0 — the version that was actually staged for release. Added a sanity check that fails the run if __init__.py reports a version that's neither the last tag nor the version we're about to ship. - Commit step now skips the commit when sed produced no diff (files already at target) and tags HEAD directly. Avoids "nothing to commit" errors when a PR pre-bumped the version files. - Reverted __init__.py and plugin.yaml from 0.3.0 back to 0.2.0 so re-running the workflow with minor produces v0.2.0 cleanly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 517847c commit d78ae3e

3 files changed

Lines changed: 43 additions & 13 deletions

File tree

.github/workflows/release.yml

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ name: release
33
# Manual trigger: Actions → release → Run workflow. Always runs against main
44
# (the workflow validates GITHUB_REF). Steps:
55
# 1. Compute the new version from the `version` input (patch/minor/major
6-
# or explicit semver). The current version is read from __init__.py.
7-
# 2. Update __version__ in __init__.py and version in plugin.yaml.
6+
# or explicit semver). The *current* version is read from the latest
7+
# git tag (`v*.*.*`) — NOT from __init__.py. This is robust to PRs that
8+
# pre-bump __init__.py: the bump always runs from the last released
9+
# version, not from whatever the working files happen to say.
10+
# 2. Update __version__ in __init__.py and version in plugin.yaml to match
11+
# the new tag — bringing the files in sync if a PR pre-bumped them.
812
# 3. Commit as `chore(release): vX.Y.Z`, tag, push to main + push the tag.
913
# 4. Publish a GitHub Release. Body is the matching `## [X.Y.Z]` block from
1014
# CHANGELOG.md when present; otherwise auto-generated release notes.
@@ -50,14 +54,21 @@ jobs:
5054
set -euo pipefail
5155
VERSION_INPUT="${{ github.event.inputs.version }}"
5256
53-
# Source of truth for the current version is __init__.py.
54-
CURRENT=$(grep -E '^__version__ = ' __init__.py \
55-
| sed -E 's/^__version__ = "([^"]+)".*/\1/')
56-
if [ -z "$CURRENT" ]; then
57-
echo "::error::Could not read __version__ from __init__.py"
58-
exit 1
57+
# Current = latest released tag (sort by version, descending; pick
58+
# the first v*.*.* tag). NOT __init__.py — a PR may have pre-bumped
59+
# the version files, and we don't want to double-bump on top of
60+
# that. The bump is computed from the last *released* version.
61+
LAST_TAG=$(git tag --list 'v*.*.*' --sort=-v:refname | head -1 || true)
62+
if [ -z "$LAST_TAG" ]; then
63+
# First release in the repo. Seed with 0.0.0 so a `patch` bump
64+
# yields v0.0.1, `minor` yields v0.1.0, `major` yields v1.0.0.
65+
# Explicit semver inputs bypass the seed entirely.
66+
CURRENT="0.0.0"
67+
echo "No prior v*.*.* tag found; seeding current=0.0.0"
68+
else
69+
CURRENT="${LAST_TAG#v}"
70+
echo "Latest released tag: $LAST_TAG (current=$CURRENT)"
5971
fi
60-
echo "Current version: $CURRENT"
6172
6273
if [[ "$VERSION_INPUT" =~ ^(patch|minor|major)$ ]]; then
6374
IFS=. read -r MAJ MIN PAT <<< "$CURRENT"
@@ -76,7 +87,19 @@ jobs:
7687
fi
7788
7889
if [ "$NEW" = "$CURRENT" ]; then
79-
echo "::error::New version equals current ($NEW). Pick a different version."
90+
echo "::error::New version equals last released ($NEW). Pick a different version."
91+
exit 1
92+
fi
93+
94+
# Sanity check: refuse if __init__.py is already ahead of the
95+
# version we're about to ship. Catches the "PR bumped to 0.5.0 but
96+
# workflow was asked for a patch that would land 0.1.8" foot-gun
97+
# before it overwrites the files.
98+
FILE_VERSION=$(grep -E '^__version__ = ' __init__.py \
99+
| sed -E 's/^__version__ = "([^"]+)".*/\1/')
100+
if [ -n "$FILE_VERSION" ] && [ "$FILE_VERSION" != "$CURRENT" ] && [ "$FILE_VERSION" != "$NEW" ]; then
101+
echo "::error::__init__.py reports version $FILE_VERSION, but the release would ship $NEW (last tag: $CURRENT)."
102+
echo "::error::Reconcile by picking a version input that matches __init__.py, or roll __init__.py back to $CURRENT."
80103
exit 1
81104
fi
82105
@@ -122,12 +145,19 @@ jobs:
122145
set -euo pipefail
123146
TAG="${{ steps.bump.outputs.tag }}"
124147
git add __init__.py plugin.yaml
125-
git commit -m "chore(release): ${TAG}"
148+
if git diff --cached --quiet; then
149+
# PR already bumped the files to the target version. Tag the
150+
# existing HEAD rather than creating an empty release commit.
151+
echo "Version files already at ${TAG}; tagging current HEAD."
152+
else
153+
git commit -m "chore(release): ${TAG}"
154+
fi
126155
git tag -a "${TAG}" -m "${TAG}"
127156
128157
- name: Push commit and tag
129158
run: |
130159
set -euo pipefail
160+
# HEAD push is a no-op when nothing was committed in this run.
131161
git push origin HEAD:main
132162
git push origin "${{ steps.bump.outputs.tag }}"
133163

__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from agent.memory_provider import MemoryProvider
3939
from tools.registry import tool_error
4040

41-
__version__ = "0.3.0"
41+
__version__ = "0.2.0"
4242

4343
logger = logging.getLogger("hermes.memory.basic-memory")
4444

plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: basic-memory
2-
version: 0.3.0
2+
version: 0.2.0
33
description: "Basic Memory — persistent knowledge graph backed by the basic-memory MCP server"
44
pip_dependencies:
55
- mcp

0 commit comments

Comments
 (0)