Shared Go Packages
 
 
Go to file
Vernon Keenan 8ef777c7e6 feat: replace manual release ritual with `make release` (ADR-KV-014)
The README's "Update Procedure" required three web UIs (GitHub branch
defaults, GitHub releases, Gitea "Synchronize Now") and a go-swagger CLI
installed nowhere. Now that lib is main+tags instead of branch-per-version,
replace it with scripts/release.sh driven through the Makefile:

- `make install-swagger` installs a pinned go-swagger (v0.35.0) and
  verifies the version.
- `make regen` copies the sibling service specs and regenerates api/
  clients exactly as the old `make swagger` ritual did, failing fast if
  a sibling spec is missing. Regen output is reviewed/committed as its
  own PR, same as any other change.
- `make release VERSION=vX.Y.Z` / `make release-dry-run VERSION=vX.Y.Z`
  validate semver + monotonicity, require a clean main checkout synced
  with origin/main, tag, push, `gh release create`, and POST to the
  Gitea mirror-sync API for the vernonkeenan/lib and work/lib mirrors
  (skipped with a loud warning if GITEA_TOKEN is unset).

Also scope the CI push trigger to `main` + `v*` tags instead of every
branch, so PRs (which already run via the `pull_request` trigger) stop
double-running.

Verified locally: bash -n + shellcheck clean; install-swagger into a
temp GOBIN across go-swagger v0.33.2-v0.35.0; semver/monotonicity/
tag-exists/branch/origin-sync validation failure paths; a full regen
against the real sibling specs in a scratch dir (never the checked-out
api/swagger). That regen surfaced a real go-swagger limitation --
documented in the README and as a warning in the script -- reproduced
across all four installable versions: an untagged operation in
sf-gate-vernonkeenan.yaml produces a client that doesn't compile.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 06:49:23 +00:00
.github/workflows feat: replace manual release ritual with `make release` (ADR-KV-014) 2026-07-12 06:49:23 +00:00
.vscode New swagger version 2022-05-28 12:45:41 -07:00
api feat(api): Generate session management API client and models 2025-05-27 03:20:36 +00:00
app Add table-driven unit tests for app/service-helpers.go pure helpers 2026-07-12 06:07:44 +00:00
build tidy new version 2021-08-05 12:37:53 -07:00
scripts feat: replace manual release ritual with `make release` (ADR-KV-014) 2026-07-12 06:49:23 +00:00
swagger feat(api): Generate session management API client and models 2025-05-27 03:20:36 +00:00
.gitignore Initial commit 2021-07-30 20:05:02 -07:00
.gitleaks.toml ci: add first-ever build/vet/test + gitleaks CI (ADR-KV-014) 2026-07-12 05:23:59 +00:00
LICENSE Remove workflow 2022-06-20 08:35:49 -07:00
Makefile feat: replace manual release ritual with `make release` (ADR-KV-014) 2026-07-12 06:49:23 +00:00
README.md feat: replace manual release ritual with `make release` (ADR-KV-014) 2026-07-12 06:49:23 +00:00
go.mod Add FullDescription field to Industry model and related structs 2024-01-22 15:39:53 +00:00
go.sum Add FullDescription field to Industry model and related structs 2024-01-22 15:39:53 +00:00

README.md

lib

vernonkeenan Shared Libraries (go)

Dependent Systems

The Gitea server https://code.tnxs.net must be up and running with admin access. It hosts world-readable pull-mirrors of this repo at vernonkeenan/lib and work/lib.

Release Procedure

As of 2026-07-12 (ADR-KV-014, DT-KV-004) this repo is main + v* tags — branch-per-version is retired, and so is the old three-web-UI-plus-CLI manual ritual. Releasing is one command: make release VERSION=vX.Y.Z.

Prerequisites

  • All the sibling service repos (auth, crm, stash, sf-gate, research, members, plex) are cloned locally in adjacent directories — regen reads each one's swagger/<service>-vernonkeenan.yaml.
  • gh installed and authenticated (gh auth login) with push access to vernonkeenan/lib — the release step calls gh release create.
  • GITEA_TOKEN exported, set to a Gitea API token (Settings -> Applications on https://code.tnxs.net) with rights to trigger a mirror-sync on vernonkeenan/lib and work/lib. If unset, make release still tags, pushes, and publishes the GitHub release — it just skips the Gitea mirror-sync step with a loud warning, so the mirrors will lag until someone clicks Synchronize Now manually or reruns with the token set. (There is no existing Gitea/tnxs token variable defined anywhere in this workstation's env files today — GITEA_TOKEN is a new name, not a rename of something already in use.)

1. Regenerate the API clients (its own PR)

make regen

This installs the pinned go-swagger CLI (SWAGGER_VERSION in the Makefile, currently v0.35.0 — bump deliberately and update both places when you do), copies each sibling repo's swagger/<service>-vernonkeenan.yaml into ./swagger and ./swagger/external, regenerates every client under api/, and rewrites the external specs' scheme/host/path exactly as the old make swagger ritual did. It fails fast, before touching anything, if any sibling spec is missing.

Review git status/git diff, commit, open a PR, and merge it to main like any other change — client regen is not bundled into the release step itself. make regen runs a non-fatal go build ./... at the end as an early warning; the real gate is CI on that PR.

Known gap: if any sibling spec has an operation with no top-level tags:, go-swagger routes it into a fallback operations package whose import path in <name>_client/<name>_client.go doesn't respect --client-package — reproduced across go-swagger v0.33.2 through v0.35.0 while building this tooling. As of this writing that's sf-gate-vernonkeenan.yaml's PUT /researchprojectservices (no tags:). Fix it at the source (add a tags: entry in the sf-gate repo's spec) rather than hand-patching generated code, since the next regen would just reintroduce it.

2. Cut the release (from a clean main checkout)

make release VERSION=v0.7.5

scripts/release.sh (invoked by the release target):

  1. Validates VERSION is vMAJOR.MINOR.PATCH and strictly greater than the latest existing tag.
  2. Requires you're on main, the tree is clean, and local main matches origin/main (no local-only commits).
  3. Runs go build ./... and go vet ./... as a last sanity check.
  4. Creates an annotated tag at HEAD, pushes it, and runs gh release create with generated notes.
  5. POSTs to the Gitea mirror-sync API for vernonkeenan/lib and work/lib (skipped with a warning if GITEA_TOKEN is unset).

Use make release-dry-run VERSION=v0.7.5 to run steps 1-3 and print what steps 4-5 would do, without tagging, pushing, publishing, or syncing anything.

3. Downstream consumers

Update the go.mod line for code.tnxs.net/vernonkeenan/lib in each dependent project to the new tag, same as before — that part of the old ritual is unchanged.