From 79b6c958fd0199a8e008bf562dde0e8b3243344e Mon Sep 17 00:00:00 2001 From: Daniel Arroyo Date: Tue, 7 Jul 2026 19:18:52 -0400 Subject: [PATCH] Bump version to 1.0.2 - Add scripts/bump-version.sh for semver patch increments - Update AGENTS.md Dev Commands section and add Version Bumping docs - Makefile default VERSION bumped to 1.0.2 --- AGENTS.md | 34 +++++++++++++++++++++++++++++----- Makefile | 2 +- cmd/server/main.go | 2 +- scripts/bump-version.sh | 29 +++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 7 deletions(-) create mode 100755 scripts/bump-version.sh diff --git a/AGENTS.md b/AGENTS.md index 2495dd7..f692df9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -7,12 +7,11 @@ Go monolith (single binary) with embedded React SPA frontend. Targets Linux amd6 ## Dev Commands ```bash -# Local dev build (macOS) -make build-local +# Clean build and package (Linux amd64) +make clean && VERSION=X.Y.Z make package -# Production Linux amd64 build -make build # → packaging/debian/usr/bin/syncserver -make deb # → dist/syncserver_VERSION_amd64.deb +# Build only (no package), Linux amd64 +make build-all # Run ./syncserver --data-dir ./data --addr :8080 \ @@ -22,6 +21,31 @@ make deb # → dist/syncserver_VERSION_amd64.deb go test ./... ``` +## Version Bumping + +Before each push that contains user-facing changes, run the version bump script: + +```bash +./scripts/bump-version.sh +``` + +This reads the current version from `cmd/server/main.go`, increments the patch number (semver), and updates both `cmd/server/main.go` and `Makefile`. Then commit and push: + +```bash +git add cmd/server/main.go Makefile +git commit -m 'Bump version to X.Y.Z' +git push +``` + +The `DEBIAN/control` uses `@@VERSION@@` placeholder and is substituted at `make package` time — no manual edit needed. + +To verify the LXC is running the expected version: + +```bash +ssh root@10.5.1.30 '/usr/bin/syncserver --version' +ssh root@10.5.1.30 'journalctl -u syncserver -n 3 --no-pager' +``` + ## Critical Build Order 1. Frontend must be built FIRST: `cd web && npm run build` diff --git a/Makefile b/Makefile index 9678d8a..a53cbe2 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ BINARY=syncserver -VERSION?=1.0.1 +VERSION?=1.0.2 GO?=go LDFLAGS=-s -w -X main.version=$(VERSION) -X main.commit=$(shell git rev-parse --short HEAD 2>/dev/null || echo unknown) BUILD_FLAGS=CGO_ENABLED=0 diff --git a/cmd/server/main.go b/cmd/server/main.go index e8a2dee..68eebb8 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -20,7 +20,7 @@ import ( "github.com/syncserver/internal/syncengine" ) -var version = "1.0.1" +var version = "1.0.2" func main() { cfgPath := flag.String("config", "", "Path to config.yaml") diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh new file mode 100755 index 0000000..305bdaf --- /dev/null +++ b/scripts/bump-version.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +MAIN_GO="$PROJECT_DIR/cmd/server/main.go" +MAKEFILE="$PROJECT_DIR/Makefile" + +CURRENT=$(grep -oE 'var version = "[0-9]+\.[0-9]+\.[0-9]+"' "$MAIN_GO" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') +if [[ -z "$CURRENT" ]]; then + echo "ERROR: cannot parse version from $MAIN_GO" >&2 + exit 1 +fi + +IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT" +NEW_PATCH=$((PATCH + 1)) +NEW="${MAJOR}.${MINOR}.${NEW_PATCH}" + +echo "Bumping version: $CURRENT → $NEW" + +sed -i '' "s/var version = \"${CURRENT}\"/var version = \"${NEW}\"/" "$MAIN_GO" +sed -i '' "s/VERSION?=${CURRENT}/VERSION?=${NEW}/" "$MAKEFILE" + +echo "Done. Updated to $NEW" +echo "" +echo "Next steps:" +echo " git add cmd/server/main.go Makefile" +echo " git commit -m 'Bump version to ${NEW}'" +echo " git push"