Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7aa0cc8

Browse files
authored
fix: set version in one place (coder#73)
1 parent 26ad537 commit 7aa0cc8

File tree

15 files changed

+92
-12
lines changed

15 files changed

+92
-12
lines changed

.github/workflows/go-test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ jobs:
3333
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
3434
with:
3535
version: v2.1
36+
37+
- name: Check for unstaged changes
38+
run: |
39+
make gen
40+
./check_unstaged.sh

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ jobs:
3333
- name: Install Chat Dependencies
3434
run: cd chat && bun install
3535

36+
- name: Run make gen and check for unstaged changes
37+
run: |
38+
make gen
39+
./check_unstaged.sh
40+
3641
- name: Build and Upload
3742
env:
3843
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.6.2
4+
5+
- Fix incorrect version string.
6+
37
## 0.6.1
48

59
### Features

MAINTAINERS.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
Before performing a release, perform a local "smoke-test".
66
If everything seems OK, you can proceed to do the following:
77

8-
1. Update the version string in the following places:
9-
- `openapi.json`
10-
- `chat/package.json`
11-
- `lib/httpapi/server.go`
8+
1. Update the version string in `internal/version/version.go` and run `make gen`.
129
2. Add details in `CHANGELOG.md` on what changed.
1310
3. Create a PR with the subject `chore: update version to X.Y.Z`
14-
4. Once the above PR is approved and merged, create a new git tag `vX.Y.Z` pointing to the commit of the above PR merged to `main`:S
11+
4. Once the above PR is approved and merged, create a new git tag `vX.Y.Z` pointing to the commit of the above PR merged to `main`:
1512

1613
```shell
14+
# Ensure your local copy is up to date with main. Be sure to stash any changes first.
15+
git fetch origin
16+
git reset --hard origin/main
1717
# Fetch existing tags first!
1818
git fetch --tags
1919
git tag -a vX.Y.Z -m 'vX.Y.Z'

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,9 @@ embed: $(CHAT_SOURCES_STAMP)
1616
@echo "Chat build is up to date."
1717

1818
.PHONY: build
19-
build: embed
19+
build: gen embed
2020
CGO_ENABLED=0 go build -o ${BINPATH} main.go
21+
22+
.PHONY: gen
23+
gen:
24+
go generate ./...

chat/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chat",
3-
"version": "0.6.1",
3+
"version": "0.6.2",
44
"private": true,
55
"scripts": {
66
"dev": "next dev --turbopack",
@@ -45,4 +45,4 @@
4545
"tw-animate-css": "^1.3.0",
4646
"typescript": "^5"
4747
}
48-
}
48+
}

check_unstaged.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
FILES=()
5+
IFS=$'\n' read -r -d '' -a FILES < <(git ls-files --other --modified --exclude-standard && printf '\0')
6+
if [[ ${#FILES[@]} -gt 0 ]]; then
7+
8+
echo
9+
echo "The following files contain unstaged changes:"
10+
echo
11+
for file in "${FILES[@]}"; do
12+
echo " - $file"
13+
done
14+
15+
echo
16+
echo "These are the changes:"
17+
echo
18+
for file in "${FILES[@]}"; do
19+
git --no-pager diff -- "$file" 1>&2
20+
done
21+
22+
echo
23+
echo "ERROR: Unstaged changes, see above for details."
24+
exit 1
25+
fi

cmd/root.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import (
66

77
"github.com/coder/agentapi/cmd/attach"
88
"github.com/coder/agentapi/cmd/server"
9+
"github.com/coder/agentapi/internal/version"
910
"github.com/spf13/cobra"
1011
)
1112

1213
var rootCmd = &cobra.Command{
1314
Use: "agentapi",
1415
Short: "AgentAPI CLI",
1516
Long: `AgentAPI - HTTP API for Claude Code, Goose, Aider, Gemini and Codex`,
16-
Version: "0.4.1",
17+
Version: version.Version,
1718
}
1819

1920
func Execute() {

cmd/server/server.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ func CreateServerCmd() *cobra.Command {
184184
return
185185
}
186186
logger := slog.New(slog.NewTextHandler(os.Stdout, nil))
187+
if viper.GetBool(FlagPrintOpenAPI) {
188+
// We don't want log output here.
189+
logger = slog.New(logctx.DiscardHandler)
190+
}
187191
ctx := logctx.WithLogger(context.Background(), logger)
188192
if err := runServer(ctx, logger, cmd.Flags().Args()); err != nil {
189193
fmt.Fprintf(os.Stderr, "%+v\n", err)

internal/version/version.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// package version defines the current version of agentapi.
2+
3+
package version
4+
5+
var Version = "0.6.2"

0 commit comments

Comments
 (0)