Skip to content

Commit 0ac5a5a

Browse files
authored
Merge branch 'main' into walker/gram-redirect-url-go-sdk
2 parents 367cb70 + 6b3bb3b commit 0ac5a5a

2 files changed

Lines changed: 39 additions & 16 deletions

File tree

.github/workflows/go-module-release.yml

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@ name: Go module release
55
on:
66
push:
77
branches: [main]
8+
# Everything the module publishes, minus what it does not. Stated as
9+
# subtraction so a new source file releases by default; an allowlist of
10+
# filenames silently stops releasing the day someone adds one. Later
11+
# patterns win, so the negations must stay below 'go/**'.
812
paths:
9-
- 'go/generated/**'
10-
- 'go/published_server_refs.txt'
11-
- 'go/go.mod'
12-
- 'go/LICENSE'
13-
- 'go/doc.go'
14-
- 'go/embed.go'
15-
- 'go/generate.go'
16-
- 'go/guides.go'
17-
- 'go/index_gen.go'
18-
- 'go/ref.go'
19-
- 'go/resolve.go'
13+
- 'go/**'
14+
- '!go/*_test.go'
15+
- '!go/**/*_test.go'
16+
- '!go/internal/**'
17+
- '!go/README.md'
18+
- '!go/check.sh'
2019
workflow_dispatch:
2120
inputs:
2221
bump:
@@ -56,9 +55,23 @@ jobs:
5655
- name: Resolve next version
5756
id: ver
5857
env:
59-
BUMP: ${{ github.event.inputs.bump || 'patch' }}
58+
BUMP_INPUT: ${{ github.event.inputs.bump }}
6059
run: |
6160
set -euo pipefail
61+
# workflow_dispatch wins. On push, a [minor] or [major] marker in the
62+
# merge commit message picks the bump, so an API change ships as one
63+
# tag instead of a throwaway patch followed by a dispatched bump.
64+
bump="${BUMP_INPUT:-}"
65+
if [ -z "$bump" ]; then
66+
msg="$(git log -1 --pretty=%B)"
67+
case "$msg" in
68+
*'[major]'*) bump=major ;;
69+
*'[minor]'*) bump=minor ;;
70+
*) bump=patch ;;
71+
esac
72+
fi
73+
echo "Bump: $bump"
74+
6275
latest="$(git tag -l 'go/v*' --sort=-v:refname | grep -E '^go/v[0-9]+\.[0-9]+\.[0-9]+$' | head -1 || true)"
6376
if [ -z "$latest" ]; then
6477
echo "No go/v* tags yet. Cut go/v0.1.0 manually once, then re-run."
@@ -70,11 +83,11 @@ jobs:
7083
7184
ver="${latest#go/v}"
7285
IFS=. read -r major minor patch <<<"$ver"
73-
case "$BUMP" in
86+
case "$bump" in
7487
major) major=$((major + 1)); minor=0; patch=0 ;;
7588
minor) minor=$((minor + 1)); patch=0 ;;
7689
patch) patch=$((patch + 1)) ;;
77-
*) echo "unknown bump: $BUMP"; exit 1 ;;
90+
*) echo "unknown bump: $bump"; exit 1 ;;
7891
esac
7992
next="go/v${major}.${minor}.${patch}"
8093
module_ver="v${major}.${minor}.${patch}"

GO-MODULE.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Created automatically on regen failure if missing:
5050
2. **Merge to `main`**`go-module-regen` runs.
5151
3. **Regen PR** — bot opens or updates [`chore/go-module-regen`](https://github.com/speakeasy-api/mcp-setup-docs/compare/main...chore/go-module-regen). Multiple guide merges while it is open are **aggregated** into that same PR. The PR body lists guide-level added/updated/removed drift (and other `go/` files) vs `main`.
5252
4. **Human merge** — wait for `Go module CI` green, then merge. Branch is **machine-owned**; don’t push fixes there (they’ll be overwritten on the next regen).
53-
5. **Release**`go-module-release` re-verifies the module, patch-bumps to the next `go/vX.Y.Z`, creates a GitHub Release (notes list guide-level added/updated/removed since the previous tag), and best-effort primes `proxy.golang.org`.
53+
5. **Release**`go-module-release` re-verifies the module, bumps to the next `go/vX.Y.Z` (patch, unless the merge commit message carries `[minor]` or `[major]`), creates a GitHub Release (notes list guide-level added/updated/removed since the previous tag), and best-effort primes `proxy.golang.org`.
5454
6. **Consumer bump** — the `go/vX.Y.Z` tag fires `go-module-consumer-bump`. It waits for the module proxy, runs `go get` + `go mod tidy` on `speakeasy-api/gram`, and opens or refreshes [`chore/bump-mcp-setup-docs-go`](https://github.com/speakeasy-api/gram/compare/main...chore/bump-mcp-setup-docs-go) there. That branch is **machine-owned** too: the next release rebuilds it from the consumer default branch and force-pushes. A human on that repo reviews and merges.
5555

5656
```text
@@ -78,7 +78,17 @@ mise run check-go # regenerate, fail on drift, go test (+ generator tests)
7878
| Bump | How |
7979
| --- | --- |
8080
| Patch (default) | Automatic on each publishable `go/` merge after `go/v0.1.0` |
81-
| Minor / major | Actions → **Go module release**`workflow_dispatch` → choose bump |
81+
| Minor / major | Put `[minor]` or `[major]` in the **merge commit message**; the automatic run reads it |
82+
| Minor / major (after the fact) | Actions → **Go module release**`workflow_dispatch` → choose bump |
83+
84+
Prefer the merge-commit marker for an API change. A `workflow_dispatch` after
85+
the automatic run leaves a throwaway patch tag behind, because the push-triggered
86+
run already tagged before you dispatched.
87+
88+
A merge is publishable when it touches `go/` outside tests, `go/internal/`,
89+
`go/README.md`, and `go/check.sh`. The release workflow states this as
90+
`go/**` minus those paths, so a new source file releases without anyone
91+
remembering to add it to a list.
8292

8393
Remote ids are append-only after the first tag (`go/published_server_refs.txt`). Removing a published `slug/remote-id` fails generation until restored or the manifest is intentionally rewritten after review.
8494

0 commit comments

Comments
 (0)