Skip to content

Commit fff32e5

Browse files
committed
Adding release flow
1 parent fa76663 commit fff32e5

4 files changed

Lines changed: 177 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Go
14+
uses: actions/setup-go@v5
15+
with:
16+
go-version: "1.25.1"
17+
cache: true
18+
19+
- name: Run tests
20+
run: go test -race -count=1 ./...

.github/workflows/release.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Go
15+
uses: actions/setup-go@v5
16+
with:
17+
go-version: "1.25.1"
18+
cache: true
19+
20+
- name: Run tests
21+
run: go test -race -count=1 ./...
22+
23+
build:
24+
needs: test
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
include:
30+
- os: ubuntu-latest
31+
goos: linux
32+
goarch: amd64
33+
- os: ubuntu-latest
34+
goos: linux
35+
goarch: arm64
36+
- os: macos-latest
37+
goos: darwin
38+
goarch: amd64
39+
- os: macos-latest
40+
goos: darwin
41+
goarch: arm64
42+
- os: windows-latest
43+
goos: windows
44+
goarch: amd64
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Set up Go
49+
uses: actions/setup-go@v5
50+
with:
51+
go-version: "1.25.1"
52+
cache: true
53+
54+
- name: Compute version
55+
id: version
56+
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
57+
58+
- name: Build binary
59+
env:
60+
GOOS: ${{ matrix.goos }}
61+
GOARCH: ${{ matrix.goarch }}
62+
CGO_ENABLED: 1
63+
run: |
64+
BINARY="enola-${{ steps.version.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}"
65+
EXT=""
66+
if [ "${{ matrix.goos }}" = "windows" ]; then
67+
EXT=".exe"
68+
fi
69+
go build \
70+
-ldflags "-s -w -X github.com/enola-labs/enola/internal/server.Version=${{ steps.version.outputs.version }}" \
71+
-o "${BINARY}${EXT}" \
72+
./cmd/enola
73+
74+
- name: Create tarball
75+
shell: bash
76+
run: |
77+
BINARY="enola-${{ steps.version.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}"
78+
EXT=""
79+
if [ "${{ matrix.goos }}" = "windows" ]; then
80+
EXT=".exe"
81+
fi
82+
tar czf "${BINARY}.tar.gz" "${BINARY}${EXT}"
83+
sha256sum "${BINARY}.tar.gz" > "${BINARY}.sha256"
84+
85+
- name: Upload to release
86+
uses: softprops/action-gh-release@v2
87+
with:
88+
files: |
89+
enola-${{ steps.version.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz
90+
enola-${{ steps.version.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}.sha256

install.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env bash
2+
# install.sh — Install the latest enola release.
3+
# Usage: curl -fsSL https://raw.githubusercontent.com/enola-labs/enola/main/install.sh | sh
4+
5+
set -euo pipefail
6+
7+
# --- Detect OS ---
8+
OS="$(uname -s)"
9+
case "$OS" in
10+
Linux) OS=linux ;;
11+
Darwin) OS=darwin ;;
12+
*) echo "Unsupported OS: $OS" >&2; exit 1 ;;
13+
esac
14+
15+
# --- Detect arch ---
16+
ARCH="$(uname -m)"
17+
case "$ARCH" in
18+
x86_64) ARCH=amd64 ;;
19+
arm64|aarch64) ARCH=arm64 ;;
20+
*) echo "Unsupported arch: $ARCH" >&2; exit 1 ;;
21+
esac
22+
23+
# --- Fetch latest version ---
24+
VERSION="$(curl -fsSL https://api.github.com/repos/enola-labs/enola/releases/latest | grep '"tag_name"' | sed -E 's/.*"v([^"]+)".*/\1/')"
25+
if [ -z "$VERSION" ]; then
26+
echo "Failed to fetch latest version" >&2
27+
exit 1
28+
fi
29+
30+
ASSET="enola-${VERSION}-${OS}-${ARCH}.tar.gz"
31+
SHASUM="${ASSET}.sha256"
32+
URL="https://github.com/enola-labs/enola/releases/download/v${VERSION}/${ASSET}"
33+
SUM_URL="https://github.com/enola-labs/enola/releases/download/v${VERSION}/${SHASUM}"
34+
35+
echo "==> Downloading enola v${VERSION} for ${OS}/${ARCH} ..."
36+
37+
TMPDIR="$(mktemp -d)"
38+
trap 'rm -rf "$TMPDIR"' EXIT
39+
40+
curl -fsSL -o "$TMPDIR/$ASSET" "$URL"
41+
curl -fsSL -o "$TMPDIR/$SHASUM" "$SUM_URL"
42+
43+
echo "==> Verifying checksum ..."
44+
(cd "$TMPDIR" && sha256sum -c "$SHASUM")
45+
46+
echo "==> Extracting ..."
47+
tar xzf "$TMPDIR/$ASSET" -C "$TMPDIR"
48+
49+
# --- Install ---
50+
BIN_NAME="enola-${VERSION}-${OS}-${ARCH}"
51+
if [ "$OS" = "windows" ]; then
52+
BIN_NAME="${BIN_NAME}.exe"
53+
fi
54+
55+
INSTALL_DIR="${ENOLA_INSTALL_DIR:-$HOME/.local/bin}"
56+
mkdir -p "$INSTALL_DIR"
57+
58+
cp "$TMPDIR/$BIN_NAME" "$INSTALL_DIR/enola"
59+
60+
echo "==> enola v${VERSION} installed to $INSTALL_DIR/enola"
61+
echo ""
62+
echo "If \$HOME/.local/bin is not in your PATH, add it:"
63+
echo " export PATH=\"$HOME/.local/bin:\$PATH\""

internal/server/server.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import (
1616
"github.com/modelcontextprotocol/go-sdk/mcp"
1717
)
1818

19+
// Version is set at build time via -ldflags.
20+
var Version = "dev"
21+
1922
// Server wraps the MCP server and connects it to the snapshot engine.
2023
type Server struct {
2124
mcp *mcp.Server
@@ -34,7 +37,7 @@ func New(eng *engine.Engine, cfg *config.Config) (*Server, error) {
3437

3538
mcpServer := mcp.NewServer(&mcp.Implementation{
3639
Name: "enola",
37-
Version: "0.1.0",
40+
Version: Version,
3841
}, nil)
3942

4043
s.mcp = mcpServer

0 commit comments

Comments
 (0)