feat: add Homebrew and Scoop publishing scripts, enhance versioning metadata
Test / testing (push) Successful in 5m30s
Release / build-and-upload (release) Failing after 9m9s

This commit is contained in:
2026-08-14 11:35:52 +02:00
parent ae30ba1240
commit 333c7468e9
9 changed files with 266 additions and 15 deletions
+5 -4
View File
@@ -91,11 +91,12 @@ func bootstrap(cmd *cli.Command) (*App, error) {
// First-run UX: if there is genuinely no config yet, an interactive
// session gets an inline wizard instead of a wall of "no profile
// configured" errors — but never for `config ...` itself (that
// subtree has its own explicit `init`) and never in a non-interactive
// context (CI, pipes), where the tool must stay driven entirely by
// flags/env instead of blocking on stdin.
// subtree has its own explicit `init`), never for `version` (which
// shouldn't need a Vault connection at all), and never in a
// non-interactive context (CI, pipes), where the tool must stay
// driven entirely by flags/env instead of blocking on stdin.
leaf := cmd.Args().First()
if !config.Exists(path) && IsInteractive() && leaf != "config" {
if !config.Exists(path) && IsInteractive() && leaf != "config" && leaf != "version" {
if _, err := runWizard(path); err != nil {
return nil, err
}
+4 -2
View File
@@ -9,11 +9,12 @@ import (
// Root builds the full command tree. DefaultCommand launches the TUI when
// vault-tui is invoked with no subcommand, matching the plan's "possible
// without any subcommand" requirement.
func Root(version string) *cli.Command {
func Root(b BuildInfo) *cli.Command {
build = b
root := &cli.Command{
Name: "vault-tui",
Usage: "Terminal UI for HashiCorp Vault",
Version: version,
Version: b.Version,
DefaultCommand: "ui",
// Deliberately no Sources: cli.EnvVars(...) here: internal/config.Resolve
// (and config.ResolvePath/SelectProfile for --config/--profile) already
@@ -49,6 +50,7 @@ func Root(version string) *cli.Command {
loginCommand(),
logoutCommand(),
statusCommand(),
versionCommand(),
listCommand(),
readCommand(),
writeCommand(),
+64
View File
@@ -0,0 +1,64 @@
package cli
import (
"context"
"fmt"
"os"
"github.com/urfave/cli/v3"
)
// BuildInfo carries version metadata baked in at build time via -ldflags
// (see the Makefile's LDFLAGS/PRERELEASE variables and the release Gitea
// Actions workflow, which sets PRERELEASE from the triggering release's
// "prerelease" flag). Root stores the value it was given so versionCommand
// and internal/ui's footer (via Build) can read it back without threading
// it through every call site.
type BuildInfo struct {
Version string // git tag (or "dev" for untagged/local builds)
Commit string
Date string
Prerelease bool
}
var build BuildInfo
// Build returns the BuildInfo Root was constructed with.
func Build() BuildInfo { return build }
// String renders "1.2.3 (commit abc1234, built 2026-08-14T12:00:00Z)",
// appending " [prerelease]" when the triggering Gitea release was marked
// as a prerelease.
func (b BuildInfo) String() string {
s := fmt.Sprintf("%s (commit %s, built %s)", valueOr(b.Version, "dev"), valueOr(b.Commit, "none"), valueOr(b.Date, "unknown"))
if b.Prerelease {
s += " [prerelease]"
}
return s
}
// versionCommand prints build metadata. Unlike every other command it does
// not touch a.Client/a.Store — see bootstrap's leaf-skip check, which keeps
// `vault-tui version` from tripping the first-run config wizard.
func versionCommand() *cli.Command {
return &cli.Command{
Name: "version",
Usage: "print version, commit, build date, and prerelease status",
Flags: []cli.Flag{
&cli.BoolFlag{Name: "json"},
},
Action: func(ctx context.Context, cmd *cli.Command) error {
b := Build()
if cmd.Bool("json") {
return printJSON(os.Stdout, map[string]any{
"version": b.Version,
"commit": b.Commit,
"date": b.Date,
"prerelease": b.Prerelease,
})
}
fmt.Println(b.String())
return nil
},
}
}