Skip to content

Commit f89446d

Browse files
authored
Merge pull request #80 from LAA-Software-Engineering/docs/ci-automated-releases-readme
ci: automated releases and README prebuilt binaries
2 parents e7980c2 + 4a8be98 commit f89446d

2 files changed

Lines changed: 173 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Auto-tag and publish cross-compiled agentctl binaries on each merge to main (patch bump),
2+
# or manually with workflow_dispatch (patch / minor / major).
3+
name: Release
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
paths-ignore:
10+
- "Makefile"
11+
- "**/*.md"
12+
workflow_dispatch:
13+
inputs:
14+
bump:
15+
description: "Semver bump over the latest v*.*.* tag"
16+
type: choice
17+
options:
18+
- patch
19+
- minor
20+
- major
21+
default: patch
22+
23+
permissions:
24+
contents: write
25+
26+
concurrency:
27+
group: release-${{ github.repository }}
28+
cancel-in-progress: false
29+
30+
jobs:
31+
release:
32+
name: Tag, build, and publish binaries
33+
runs-on: ubuntu-latest
34+
timeout-minutes: 20
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
41+
- name: Compute next version tag
42+
id: version
43+
env:
44+
EVENT_NAME: ${{ github.event_name }}
45+
INPUT_BUMP: ${{ github.event.inputs.bump }}
46+
run: |
47+
set -euo pipefail
48+
BUMP=patch
49+
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
50+
BUMP="${INPUT_BUMP:-patch}"
51+
fi
52+
53+
git fetch --tags --force
54+
55+
latest=""
56+
while IFS= read -r t; do
57+
if [[ "$t" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
58+
latest="$t"
59+
break
60+
fi
61+
done < <(git tag -l 'v*' --sort=-v:refname)
62+
63+
if [ -z "$latest" ]; then
64+
case "$BUMP" in
65+
major) next="v1.0.0" ;;
66+
*) next="v0.1.0" ;;
67+
esac
68+
echo "Latest stable tag: <none>"
69+
echo "First release ($BUMP) → $next"
70+
echo "tag=$next" >> "$GITHUB_OUTPUT"
71+
exit 0
72+
fi
73+
74+
ver="${latest#v}"
75+
major="${ver%%.*}"
76+
rest="${ver#*.}"
77+
minor="${rest%%.*}"
78+
patch="${rest#*.}"
79+
80+
case "$BUMP" in
81+
major)
82+
major=$((major + 1))
83+
minor=0
84+
patch=0
85+
;;
86+
minor)
87+
minor=$((minor + 1))
88+
patch=0
89+
;;
90+
patch)
91+
patch=$((patch + 1))
92+
;;
93+
*)
94+
echo "unknown bump: $BUMP" >&2
95+
exit 1
96+
;;
97+
esac
98+
99+
next="v${major}.${minor}.${patch}"
100+
echo "Latest stable tag: $latest"
101+
echo "Bump: $BUMP → $next"
102+
echo "tag=$next" >> "$GITHUB_OUTPUT"
103+
104+
- name: Set up Go
105+
uses: actions/setup-go@v5
106+
with:
107+
go-version: "1.22.x"
108+
cache: true
109+
110+
- name: Verify modules
111+
run: |
112+
go mod download
113+
go mod verify
114+
115+
- name: Test
116+
run: go test ./... -count=1 -timeout=10m
117+
118+
- name: Build release binaries
119+
env:
120+
CGO_ENABLED: "0"
121+
VERSION: ${{ steps.version.outputs.tag }}
122+
run: |
123+
set -euo pipefail
124+
MODULE=github.com/LAA-Software-Engineering/agentic-control-plane/internal/cli
125+
LDFLAGS="-s -w -X ${MODULE}.Version=${VERSION}"
126+
mkdir -p dist work/linux-amd64 work/linux-arm64 work/darwin-amd64 work/darwin-arm64 work/windows-amd64
127+
128+
GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="$LDFLAGS" -o work/linux-amd64/agentctl ./cmd/agentctl
129+
GOOS=linux GOARCH=arm64 go build -trimpath -ldflags="$LDFLAGS" -o work/linux-arm64/agentctl ./cmd/agentctl
130+
GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags="$LDFLAGS" -o work/darwin-amd64/agentctl ./cmd/agentctl
131+
GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags="$LDFLAGS" -o work/darwin-arm64/agentctl ./cmd/agentctl
132+
GOOS=windows GOARCH=amd64 go build -trimpath -ldflags="$LDFLAGS" -o work/windows-amd64/agentctl.exe ./cmd/agentctl
133+
134+
(cd work/linux-amd64 && tar czf "../../dist/agentctl-${VERSION}-linux-amd64.tar.gz" agentctl)
135+
(cd work/linux-arm64 && tar czf "../../dist/agentctl-${VERSION}-linux-arm64.tar.gz" agentctl)
136+
(cd work/darwin-amd64 && tar czf "../../dist/agentctl-${VERSION}-darwin-amd64.tar.gz" agentctl)
137+
(cd work/darwin-arm64 && tar czf "../../dist/agentctl-${VERSION}-darwin-arm64.tar.gz" agentctl)
138+
(cd work/windows-amd64 && zip -q "../../dist/agentctl-${VERSION}-windows-amd64.zip" agentctl.exe)
139+
140+
(cd dist && sha256sum *.tar.gz *.zip | tee SHA256SUMS.txt)
141+
142+
- name: Publish GitHub Release
143+
uses: softprops/action-gh-release@v2
144+
with:
145+
tag_name: ${{ steps.version.outputs.tag }}
146+
name: ${{ steps.version.outputs.tag }}
147+
target_commitish: ${{ github.sha }}
148+
files: |
149+
dist/*.tar.gz
150+
dist/*.zip
151+
dist/SHA256SUMS.txt
152+
generate_release_notes: true
153+
env:
154+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Agentic Control Plane
22

33
[![CI](https://github.com/LAA-Software-Engineering/agentic-control-plane/actions/workflows/ci.yml/badge.svg)](https://github.com/LAA-Software-Engineering/agentic-control-plane/actions/workflows/ci.yml)
4+
[![Release](https://github.com/LAA-Software-Engineering/agentic-control-plane/actions/workflows/release.yml/badge.svg)](https://github.com/LAA-Software-Engineering/agentic-control-plane/actions/workflows/release.yml)
45
[![Go 1.22+](https://img.shields.io/badge/Go-1.22+-00ADD8?logo=go)](https://go.dev/dl/)
56
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
67
[![Go Reference](https://pkg.go.dev/badge/github.com/LAA-Software-Engineering/agentic-control-plane.svg)](https://pkg.go.dev/github.com/LAA-Software-Engineering/agentic-control-plane)
@@ -57,7 +58,8 @@ See **section 18 (MVP)** and **section 19 (End Goal)** in [`docs/DESIGN_DOC.md`]
5758

5859
### Prerequisites
5960

60-
- [Go 1.22+](https://go.dev/dl/)
61+
- **From source:** [Go 1.22+](https://go.dev/dl/)
62+
- **From a [release binary](#prebuilt-binaries):** no Go toolchain; put `agentctl` (or `agentctl.exe`) on your `PATH` after extracting the archive
6163

6264
### Build
6365

@@ -69,6 +71,22 @@ make build # writes bin/agentctl
6971

7072
Or: `make install` / `go install ./cmd/agentctl` (honours `GOBIN` / `GOPATH/bin`; ensure that directory is on `PATH`).
7173

74+
### Prebuilt binaries
75+
76+
[GitHub Releases](https://github.com/LAA-Software-Engineering/agentic-control-plane/releases) ship **`agentctl`** for common platforms (`.tar.gz` on Linux/macOS, `.zip` on Windows) plus **`SHA256SUMS.txt`**. Pick the archive that matches your machine, for example:
77+
78+
| Platform | Asset suffix |
79+
|----------|----------------|
80+
| Linux x86_64 | `linux-amd64.tar.gz` |
81+
| Linux arm64 | `linux-arm64.tar.gz` |
82+
| macOS Intel | `darwin-amd64.tar.gz` |
83+
| macOS Apple Silicon | `darwin-arm64.tar.gz` |
84+
| Windows x86_64 | `windows-amd64.zip` (contains `agentctl.exe`) |
85+
86+
`agentctl version` reports the release tag (e.g. `v0.1.4`).
87+
88+
Releases are **created automatically** when changes land on **`main`**, using a **patch** semver bump over the latest `vMAJOR.MINOR.PATCH` tag (merges that only touch Markdown or the root `Makefile` do not trigger a release). To cut **minor** or **major** bumps on demand, run the [**Release** workflow](https://github.com/LAA-Software-Engineering/agentic-control-plane/actions/workflows/release.yml) manually (**Actions → Release → Run workflow**) and choose the bump type.
89+
7290
### Create a project and run the loop
7391

7492
From the repo root (or anywhere):

0 commit comments

Comments
 (0)