Skip to content

Commit 96df2b4

Browse files
authored
Merge pull request #17 from chatbotkit/next
Release go-sdk
2 parents 2f86b32 + 6f3d039 commit 96df2b4

5 files changed

Lines changed: 215 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Continuous Integration for the go-sdk.
2+
#
3+
# Runs build, vet, format check and tests, plus a cross-compile matrix across
4+
# every OS/arch consumers ship on. The cross-compile job exists specifically to
5+
# catch platform-portability regressions (e.g. Unix-only syscalls) at the
6+
# source, before they reach downstream binaries.
7+
#
8+
# Scope matches the Makefile's PACKAGES (library packages only). The examples/
9+
# tree is excluded because some examples depend on generated, gitignored files
10+
# (e.g. portable-embedded-agent/secrets_gen.go).
11+
name: CI
12+
13+
on:
14+
push:
15+
branches:
16+
- main
17+
- next
18+
paths-ignore:
19+
- '**.md'
20+
- 'docs/**'
21+
- 'LICENSE'
22+
pull_request:
23+
branches:
24+
- main
25+
- next
26+
paths-ignore:
27+
- '**.md'
28+
- 'docs/**'
29+
- 'LICENSE'
30+
31+
permissions:
32+
contents: read
33+
34+
env:
35+
PACKAGES: ./sdk/... ./agent/... ./types/... ./internal/...
36+
37+
jobs:
38+
check:
39+
name: Build, Vet & Test
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
45+
- name: Set up Go
46+
uses: actions/setup-go@v5
47+
with:
48+
go-version-file: 'go.mod'
49+
cache: true
50+
51+
- name: Vet
52+
run: make vet
53+
54+
- name: Format check
55+
run: make fmt-check
56+
57+
- name: Test
58+
run: make test
59+
60+
- name: Build
61+
run: go build ${{ env.PACKAGES }}
62+
63+
cross-compile:
64+
name: Cross-compile (${{ matrix.goos }}/${{ matrix.goarch }})
65+
runs-on: ubuntu-latest
66+
needs: check
67+
strategy:
68+
fail-fast: false
69+
matrix:
70+
include:
71+
- goos: linux
72+
goarch: amd64
73+
- goos: linux
74+
goarch: arm64
75+
- goos: darwin
76+
goarch: amd64
77+
- goos: darwin
78+
goarch: arm64
79+
- goos: windows
80+
goarch: amd64
81+
82+
steps:
83+
- name: Checkout
84+
uses: actions/checkout@v4
85+
86+
- name: Set up Go
87+
uses: actions/setup-go@v5
88+
with:
89+
go-version-file: 'go.mod'
90+
cache: true
91+
92+
- name: Cross-compile
93+
env:
94+
GOOS: ${{ matrix.goos }}
95+
GOARCH: ${{ matrix.goarch }}
96+
CGO_ENABLED: '0'
97+
run: go build ${{ env.PACKAGES }}

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Release workflow for the go-sdk.
2+
#
3+
# go-sdk is a library, not a binary — for a Go module the git tag *is* the
4+
# release (consumers fetch source via `go get`). This workflow therefore does
5+
# not build or publish artifacts; it only creates a GitHub Release with
6+
# auto-generated notes for the tag created by tag-release.yml.
7+
#
8+
# Triggered by tag-release.yml (workflow_dispatch at the new tag) or by a
9+
# manually pushed `v*` tag.
10+
name: Release
11+
12+
on:
13+
push:
14+
tags:
15+
- 'v*'
16+
workflow_dispatch:
17+
18+
permissions:
19+
contents: write
20+
21+
jobs:
22+
release:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Create GitHub Release
31+
uses: softprops/action-gh-release@v2
32+
with:
33+
generate_release_notes: true

.github/workflows/tag-release.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Auto-tag when merging to main
2+
#
3+
# Reads the version from the VERSION file and, if the matching tag does not
4+
# already exist, creates and pushes it. For a Go module the tag *is* the
5+
# release, so this is what makes `go get @latest` / pinned versions resolve.
6+
name: Tag Release
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
13+
jobs:
14+
tag:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
actions: write
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Get version from VERSION file
26+
id: version
27+
run: |
28+
if [ -f VERSION ]; then
29+
VERSION=$(cat VERSION)
30+
else
31+
VERSION="0.0.0"
32+
fi
33+
echo "version=$VERSION" >> $GITHUB_OUTPUT
34+
echo "Version: $VERSION"
35+
36+
- name: Check if tag exists
37+
id: check_tag
38+
run: |
39+
if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
40+
echo "exists=true" >> $GITHUB_OUTPUT
41+
echo "Tag v${{ steps.version.outputs.version }} already exists"
42+
else
43+
echo "exists=false" >> $GITHUB_OUTPUT
44+
echo "Tag v${{ steps.version.outputs.version }} does not exist"
45+
fi
46+
47+
- name: Create and push tag
48+
if: steps.check_tag.outputs.exists == 'false'
49+
run: |
50+
git config user.name "github-actions[bot]"
51+
git config user.email "github-actions[bot]@users.noreply.github.com"
52+
git tag -a "v${{ steps.version.outputs.version }}" -m "Release v${{ steps.version.outputs.version }}"
53+
git push origin "v${{ steps.version.outputs.version }}"
54+
55+
- name: Trigger release workflow
56+
if: steps.check_tag.outputs.exists == 'false'
57+
uses: actions/github-script@v7
58+
with:
59+
script: |
60+
await github.rest.actions.createWorkflowDispatch({
61+
owner: context.repo.owner,
62+
repo: context.repo.repo,
63+
workflow_id: 'release.yml',
64+
ref: 'v${{ steps.version.outputs.version }}'
65+
})

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,25 @@ if err != nil {
573573

574574
- Go 1.21 or later
575575

576+
## Releasing
577+
578+
Versions are published as Git tags — for a Go module, the tag _is_ the release.
579+
The version is driven by the [`VERSION`](VERSION) file:
580+
581+
1. Bump `VERSION` (semver, no `v` prefix — e.g. `0.2.0`) in a pull request.
582+
2. Merge to `main`. The `Tag Release` workflow reads `VERSION` and, if the
583+
matching `vX.Y.Z` tag does not yet exist, creates and pushes it, then
584+
triggers the `Release` workflow to publish GitHub release notes.
585+
586+
Consumers then pin the new version:
587+
588+
```bash
589+
go get github.com/chatbotkit/go-sdk@v0.2.0
590+
```
591+
592+
While the API is still evolving the module stays on `v0.x` (minor versions may
593+
introduce breaking changes); it will move to `v1.0.0` once the API is stable.
594+
576595
## License
577596

578597
See [LICENSE](LICENSE) for details.

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0

0 commit comments

Comments
 (0)