Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: "1.25"

- name: Build
env:
Expand All @@ -46,7 +46,7 @@ jobs:
if [ "${{ matrix.goos }}" = "windows" ]; then
BINARY="${BINARY}.exe"
fi
go build -trimpath -ldflags="-s -w" -o "${BINARY}" ./cmd/server/
go build -trimpath -ldflags="-s -w -X main.Version=${{ github.ref_name }}" -o "${BINARY}" ./cmd/server/

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion Containerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build stage
FROM golang:1.22-alpine AS builder
FROM golang:1.25-alpine AS builder

WORKDIR /app

Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ help:
@sed -n 's/^## //p' $(MAKEFILE_LIST) | column -t -s ':'

## build: Compile the binary
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")

build:
@echo "πŸ”¨ Building $(BINARY_NAME)..."
@echo "πŸ”¨ Building $(BINARY_NAME) $(VERSION)..."
@mkdir -p $(BUILD_DIR)
go build -trimpath -ldflags="-s -w" -o $(BUILD_DIR)/$(BINARY_NAME) $(MAIN_PKG)
go build -trimpath -ldflags="-s -w -X main.Version=$(VERSION)" -o $(BUILD_DIR)/$(BINARY_NAME) $(MAIN_PKG)
@echo "βœ… Built β†’ $(BUILD_DIR)/$(BINARY_NAME)"

## run: Build and run the server
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p align="center">
<a href="https://github.com/fajarhide/heimsense/stargazers"><img src="https://img.shields.io/github/stars/fajarhide/heimsense?style=for-the-badge" alt="Stars"/></a>
<a href="https://github.com/fajarhide/heimsense/releases"><img src="https://img.shields.io/badge/Updated-Mar_31,_2026-brightgreen?style=for-the-badge" alt="Last Update"/></a>
<a href="./go.mod"><img src="https://img.shields.io/badge/Go-1.22+-00ADD8?style=for-the-badge&logo=go&logoColor=white" alt="Go Version"/></a>
<a href="./go.mod"><img src="https://img.shields.io/badge/Go-1.25+-00ADD8?style=for-the-badge&logo=go&logoColor=white" alt="Go Version"/></a>
<a href="#-supported-providers"><img src="https://img.shields.io/badge/Providers-20+-orange?style=for-the-badge" alt="Supported Providers"/></a>
<a href="./Containerfile"><img src="https://img.shields.io/badge/Container-ready-blueviolet?style=for-the-badge&logo=podman&logoColor=white" alt="Container Ready"/></a>
<a href="https://github.com/fajarhide/heimsense/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/fajarhide/heimsense/ci.yml?style=for-the-badge&label=CI" alt="CI"/></a>
Expand Down
33 changes: 31 additions & 2 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
"os"
"os/signal"
"runtime/debug"
"syscall"
"time"

Expand All @@ -18,7 +19,7 @@ import (

// Version is the current version of the Heimsense binary.
// Can be overridden via -ldflags="-X main.Version=v0.1.x"
var Version = "v0.1.1"
var Version = "dev"

func main() {
if len(os.Args) < 2 {
Expand Down Expand Up @@ -54,7 +55,7 @@ func main() {
}
os.Exit(0)
case "version", "-v", "--version":
fmt.Printf("heimsense version %s\n", Version)
fmt.Printf("heimsense version %s\n", getVersion())
os.Exit(0)
case "help", "-h", "--help":
printHelp()
Expand Down Expand Up @@ -191,3 +192,31 @@ func printHelp() {
fmt.Println(" heimsense sync (Sync manual .env changes to Claude Code)")
fmt.Println()
}

// getVersion returns the current version, optionally falling back to vcs info.
func getVersion() string {
if Version != "dev" {
return Version
}
if info, ok := debug.ReadBuildInfo(); ok {
if info.Main.Version != "(devel)" && info.Main.Version != "" {
return info.Main.Version
}
var revision, modified string
for _, setting := range info.Settings {
if setting.Key == "vcs.revision" {
revision = setting.Value
}
if setting.Key == "vcs.modified" && setting.Value == "true" {
modified = "-dirty"
}
}
if revision != "" {
if len(revision) > 7 {
revision = revision[:7]
}
return fmt.Sprintf("dev-%s%s", revision, modified)
}
}
return Version
}
Loading