commit b4aa42bab7ac1a2f436ee62c3d3a4fa60892c03a
parent 0c84ec2be766404ec3c85a39ac7806624ebe0c07
Author: arjoonn <arjoonn@midpathsoftware.com>
Date: Sat, 28 Feb 2026 10:32:42 +0530
x
Diffstat:
5 files changed, 68 insertions(+), 8 deletions(-)
diff --git a/VERSION b/VERSION
@@ -0,0 +1 @@
+1.0.0
diff --git a/cmd/git-jci/main.go b/cmd/git-jci/main.go
@@ -7,6 +7,10 @@ import (
"github.com/exedev/git-jci/internal/jci"
)
+// version is set at build time via -ldflags "-X main.version=<version>".
+// It falls back to "dev" when built without the flag (e.g. go run).
+var version = "dev"
+
func main() {
if len(os.Args) < 2 {
printUsage()
@@ -28,6 +32,9 @@ func main() {
err = jci.Pull(args)
case "prune":
err = jci.Prune(args)
+ case "version", "--version", "-v":
+ fmt.Println("git-jci version " + version)
+ return
case "help", "-h", "--help":
printUsage()
return
@@ -44,16 +51,18 @@ func main() {
}
func printUsage() {
- fmt.Println(`git-jci - Local-first CI system stored in git
+ fmt.Printf(`git-jci %s - Local-first CI system stored in git
Usage: git jci <command> [options]
Commands:
- run Run CI for the current commit and store results
- web Start a web server to view CI results
- push Push CI results to remote
- pull Pull CI results from remote
- prune Remove old CI results
+ run Run CI for the current commit and store results
+ web Start a web server to view CI results
+ push Push CI results to remote
+ pull Pull CI results from remote
+ prune Remove old CI results
+ version Print the version and exit
-CI results are stored in refs/jci/<commit> namespace.`)
+CI results are stored in refs/jci/<commit> namespace.
+`, version)
}
diff --git a/scripts/build_binary.sh b/scripts/build_binary.sh
@@ -27,6 +27,10 @@ GOARM="${GOARM:-7}"
cd "${REPO_DIR}"
+# Read the version from the VERSION file at the repo root.
+VERSION="$(cat "${REPO_DIR}/VERSION" | tr -d '[:space:]')"
+echo "[${OUTPUT_BINARY_NAME}] Version: ${VERSION}"
+
echo "[${OUTPUT_BINARY_NAME}] Downloading dependencies..."
go mod download
@@ -40,7 +44,7 @@ GOARM="${GOARM}" \
go build \
-buildvcs=false \
-tags "netgo osusergo" \
- -ldflags "-s -w -extldflags '-static'" \
+ -ldflags "-s -w -X main.version=${VERSION} -extldflags '-static'" \
-o "${OUTPUT_DIR}/${OUTPUT_BINARY_NAME}" \
"${ENTRY_POINT}"
diff --git a/scripts/bump_version.sh b/scripts/bump_version.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+# bump_version.sh <new-version>
+#
+# Updates the single source of truth (VERSION) and all derived locations:
+# - VERSION
+# - www_jci/public/index.html (<span id="jci-version">)
+#
+# The Go binary picks up the version automatically at build time via
+# -ldflags "-X main.version=<version>" in scripts/build_binary.sh.
+#
+# Usage:
+# ./scripts/bump_version.sh 1.2.3
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
+
+NEW_VERSION="${1:-}"
+if [[ -z "${NEW_VERSION}" ]]; then
+ echo "Usage: $0 <new-version> e.g. $0 1.2.3" >&2
+ exit 1
+fi
+
+# Strip a leading 'v' if the caller passed e.g. v1.2.3
+NEW_VERSION="${NEW_VERSION#v}"
+
+echo "Bumping version to ${NEW_VERSION}..."
+
+# 1. Write VERSION file
+echo "${NEW_VERSION}" > "${REPO_ROOT}/VERSION"
+echo " ✓ VERSION"
+
+# 2. Update the span in index.html
+INDEX_HTML="${REPO_ROOT}/www_jci/public/index.html"
+sed -i "s|<span id=\"jci-version\">.*</span>|<span id=\"jci-version\">v${NEW_VERSION}</span>|" \
+ "${INDEX_HTML}"
+echo " ✓ www_jci/public/index.html"
+
+echo ""
+echo "Done. Next steps:"
+echo " 1. Update CHANGELOG.md with release notes for v${NEW_VERSION}"
+echo " 2. git add VERSION www_jci/public/index.html CHANGELOG.md"
+echo " 3. git commit -m \"chore: bump version to v${NEW_VERSION}\""
+echo " 4. git tag v${NEW_VERSION}"
+echo " 5. Rebuild binaries (scripts/build_binary.sh per platform)"
diff --git a/www_jci/public/index.html b/www_jci/public/index.html
@@ -15,6 +15,7 @@
<div>
<a href="/binaries.html">Binaries</a>
<a href="/releases/file/README.md.html">Docs</a>
+ <span id="jci-version">v1.0.0</span>
</div>
</nav>
<h1><img src="assets/logo.png" alt="JCI logo" style="height:1em;width:auto;vertical-align:middle;margin-right:0.4em;">Minimal. Offline. Local.</h1>