Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Keep beta artifacts outside stable release channel

Rach Pradhana33954d02f6d
diff --git a/.github/workflows/beta-release.yml b/.github/workflows/beta-release.yml
index 2a09e0c4..6bd61292 100644
--- a/.github/workflows/beta-release.yml
+++ b/.github/workflows/beta-release.yml
@@ -54,7 +54,6 @@ jobs:
rm -r "$name"
done
(cd beta-cli && sha256sum graff-*.tar.gz > SHA256SUMS)
- cp install.sh beta-cli/
- uses: actions/upload-artifact@v7
with:
name: beta-cli
@@ -129,13 +128,16 @@ jobs:
with:
name: beta-linux
path: beta-assets
+ - name: Recheck release branch head
+ id: fresh
+ run: python3 scripts/beta-release.py guard --branch "$GITHUB_REF_NAME" --sha "$GITHUB_SHA"
- name: Publish beta prerelease
+ if: steps.fresh.outputs.publish == 'true'
env:
GH_TOKEN: ${{ github.token }}
BETA_TAG: ${{ needs.plan.outputs.tag }}
run: |
set -euo pipefail
- python3 scripts/beta-release.py guard --branch "$GITHUB_REF_NAME" --sha "$GITHUB_SHA"
test -f beta-assets/SHA256SUMS
test -f beta-assets/Codegraff-linux-amd64.deb
gh release create "$BETA_TAG" beta-assets/* \
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 74a73448..3af1c096 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -5,7 +5,7 @@ name: release
# version baked into `--version` comes from the tag via -Dversion.
on:
push:
- tags: ["v*"]
+ tags: ["v*", "!v*-*"]
permissions:
contents: write
@@ -16,6 +16,9 @@ jobs:
steps:
- uses: actions/checkout@v7
+ - name: Validate stable release tag
+ run: python3 scripts/check-release-tag.py "$GITHUB_REF_NAME"
+
- name: Install Zig
uses: ./.github/actions/setup-codegraff-zig
@@ -88,6 +91,8 @@ jobs:
timeout-minutes: 40
steps:
- uses: actions/checkout@v7
+ - name: Validate stable release tag
+ run: python3 scripts/check-release-tag.py "$GITHUB_REF_NAME"
- uses: oven-sh/setup-bun@v2
with:
bun-version: "1.4.2"
diff --git a/AGENTS.md b/AGENTS.md
index 309561cd..f2483717 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -139,7 +139,9 @@ latest beta.
Beta releases are GitHub prereleases and must explicitly remain outside the
stable `latest` pointer and desktop updater feed. The stable tag workflow is
-unchanged. CI can publish the CLI and unsigned Linux desktop package; macOS
+restricted to numeric stable tags. The beta CLI release has no installer;
+download the versioned tarball from the specific prerelease. CI can publish
+the CLI and unsigned Linux desktop package; macOS
desktop distribution still requires the repository's Developer ID signing,
provisioning profile, and notarization on a configured Mac. Its CI build is an
intermediate artifact only. Attach a signed beta DMG to that same prerelease
diff --git a/apps/native/electron/README.md b/apps/native/electron/README.md
index b5c995c0..57aa35f1 100644
--- a/apps/native/electron/README.md
+++ b/apps/native/electron/README.md
@@ -259,6 +259,12 @@ GRAFF_VERSION=VERSION bash apps/native/electron/build.sh
bash apps/native/electron/publish-linux.sh vVERSION zig-out/electron
```
+That attaches `Codegraff-linux-amd64.deb` (or `arm64`) and
+`Codegraff-linux-<arch>-SHA256SUMS`. An AppImage is included when
+`appimagetool` was on `PATH` during the build. There is no notarization step
+on Linux; the upload is the unsigned `.deb` `build.sh` wrote. A development
+bundle (`GRAFF_DEV=1`) is not a release asset.
+
## Beta builds
Every push to the newest numeric `release/v...` branch starts the beta workflow.
@@ -267,6 +273,8 @@ The prerelease tag includes the branch version, workflow run number and attempt
Linux desktop package to a GitHub prerelease. The macOS job saves its built
`Codegraff.app` as a short-lived workflow artifact for signing. It is not a
download in the prerelease until a configured Mac signs and notarizes it.
+The beta CLI has no `install.sh` asset: download the tarball from its specific
+prerelease, since the general installer selects the latest stable release.
On that Mac, download and extract the matching `beta-macos-build` workflow
artifact. With the same signing environment used for stable releases, run:
@@ -282,9 +290,3 @@ bash apps/native/electron/publish-beta-macos.sh vVERSION-beta.RUN.ATTEMPT zig-ou
The beta DMG receives the same signing, notarization and Gatekeeper checks as
stable releases. Beta apps carry no stable update feed, and beta releases never
become GitHub's stable Latest release. Install a later release manually.
-
-That attaches `Codegraff-linux-amd64.deb` (or `arm64`) and
-`Codegraff-linux-<arch>-SHA256SUMS`. An AppImage is included when
-`appimagetool` was on `PATH` during the build. There is no notarization step
-on Linux; the upload is the unsigned `.deb` `build.sh` wrote. A development
-bundle (`GRAFF_DEV=1`) is not a release asset.
diff --git a/scripts/beta-release.py b/scripts/beta-release.py
index f836f35f..61698179 100644
--- a/scripts/beta-release.py
+++ b/scripts/beta-release.py
@@ -50,6 +50,13 @@ def plan(branch, sha, run_number, run_attempt, heads):
return {"version": version, "tag": f"v{version}"}
+def write_output(values):
+ output = os.environ.get("GITHUB_OUTPUT")
+ if output:
+ with open(output, "a", encoding="utf-8") as stream:
+ stream.writelines(f"{key}={value}\n" for key, value in values.items())
+
+
def main():
parser = argparse.ArgumentParser()
parser.add_argument("mode", choices=("plan", "guard"))
@@ -60,17 +67,15 @@ def main():
args = parser.parse_args()
heads = remote_heads()
if args.mode == "guard":
- if not current_beta(args.branch, args.sha, heads):
- raise SystemExit("Release branch or commit is no longer current; beta publication skipped")
+ fresh = current_beta(args.branch, args.sha, heads)
+ write_output({"publish": "true" if fresh else "false"})
+ if not fresh:
+ print("Release branch or commit is no longer current; beta publication skipped")
return
result = plan(args.branch, args.sha, args.run_number, args.run_attempt, heads)
if result is None:
print("This push is not the latest release branch head; beta build skipped")
- output = os.environ["GITHUB_OUTPUT"]
- with open(output, "a", encoding="utf-8") as stream:
- stream.write(f"build={'true' if result else 'false'}\n")
- if result:
- stream.writelines(f"{key}={value}\n" for key, value in result.items())
+ write_output({"build": "true" if result else "false", **(result or {})})
if __name__ == "__main__":
diff --git a/scripts/check-release-tag.py b/scripts/check-release-tag.py
new file mode 100644
index 00000000..ee7b4a6e
--- /dev/null
+++ b/scripts/check-release-tag.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python3
+"""Reject prerelease and malformed tags from the stable publication path."""
+
+import re
+import sys
+
+STABLE_TAG = re.compile(r"^v\d+\.\d+\.\d+(?:\.\d+)?$")
+
+
+def is_stable_tag(tag):
+ return STABLE_TAG.fullmatch(tag) is not None
+
+
+if __name__ == "__main__":
+ if len(sys.argv) != 2 or not is_stable_tag(sys.argv[1]):
+ raise SystemExit("Expected a stable vX.Y.Z or vX.Y.Z.W tag")
diff --git a/scripts/test-beta-release.py b/scripts/test-beta-release.py
index a305b3e8..ac358fe8 100644
--- a/scripts/test-beta-release.py
+++ b/scripts/test-beta-release.py
@@ -1,11 +1,19 @@
import importlib.util
+import os
import pathlib
+import subprocess
+import sys
+import tempfile
import unittest
+from unittest import mock
module_path = pathlib.Path(__file__).with_name("beta-release.py")
spec = importlib.util.spec_from_file_location("beta_release", module_path)
beta = importlib.util.module_from_spec(spec)
spec.loader.exec_module(beta)
+tag_spec = importlib.util.spec_from_file_location("release_tag", module_path.with_name("check-release-tag.py"))
+release_tag = importlib.util.module_from_spec(tag_spec)
+tag_spec.loader.exec_module(release_tag)
class BetaReleaseTests(unittest.TestCase):
@@ -44,6 +52,30 @@ class BetaReleaseTests(unittest.TestCase):
with self.assertRaises(ValueError):
beta.current_beta(branch, "sha", {"release/v0.0.302.4": "sha"})
+ def test_stable_and_beta_channels_remain_separate(self):
+ self.assertTrue(release_tag.is_stable_tag("v0.0.302"))
+ self.assertTrue(release_tag.is_stable_tag("v0.0.302.4"))
+ for tag in ("v0.0.302.4-beta.20.1", "v0.0.302-rc.1", "v0.0.302.4.1", "vnext"):
+ self.assertFalse(release_tag.is_stable_tag(tag))
+ stable_workflow = (module_path.parent.parent / ".github/workflows/release.yml").read_text()
+ beta_workflow = (module_path.parent.parent / ".github/workflows/beta-release.yml").read_text()
+ self.assertIn('"!v*-*"', stable_workflow)
+ self.assertEqual(stable_workflow.count("scripts/check-release-tag.py"), 2)
+ self.assertNotIn("install.sh", beta_workflow)
+ self.assertIn("--prerelease --latest=false", beta_workflow)
+
+ def test_stale_publication_is_a_clean_skip_but_remote_error_fails(self):
+ argv = ["beta-release.py", "guard", "--branch", "release/v0.0.302.4", "--sha", "old"]
+ with tempfile.TemporaryDirectory() as directory:
+ output = pathlib.Path(directory) / "output"
+ with mock.patch.object(sys, "argv", argv), mock.patch.dict(os.environ, {"GITHUB_OUTPUT": str(output)}):
+ with mock.patch.object(beta, "remote_heads", return_value={"release/v0.0.302.4": "new"}):
+ beta.main()
+ self.assertEqual(output.read_text(), "publish=false\n")
+ with mock.patch.object(beta, "remote_heads", side_effect=subprocess.CalledProcessError(1, "git ls-remote")):
+ with self.assertRaises(subprocess.CalledProcessError):
+ beta.main()
+
if __name__ == "__main__":
unittest.main()