Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jobs:
- uses: actions/setup-go@v6
with:
go-version: "1.25.x"
- name: Capture Go version
# GoReleaser has no built-in go-version var; expose it for the ldflags.
# Use `go env GOVERSION` (e.g. go1.25.9) — a single token, since ldflag
# values must not contain spaces (`go version ...` would break linking).
run: echo "GOVERSION=$(go env GOVERSION)" >> "$GITHUB_ENV"
- name: Run GoReleaser
# Third-party action pinned to a full commit SHA (supply-chain policy).
uses: goreleaser/goreleaser-action@5daf1e915a5f0af01ddbcd89a43b8061ff4f1a89 # v7.2.2
Expand Down
13 changes: 11 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ version: 2

project_name: starcli

# GoVersion isn't a built-in GoReleaser template var, so the release workflow
# exports `GOVERSION=$(go version)` into the env; this entry surfaces it (and
# stays empty for a local `--snapshot` where it isn't set, rather than erroring).
env:
- GOVERSION={{ if index .Env "GOVERSION" }}{{ .Env.GOVERSION }}{{ end }}

before:
hooks:
- go mod download
Expand All @@ -33,9 +39,12 @@ builds:
ldflags:
- -s -w
- -X github.com/1set/starcli/config.AppName=starcli
- -X github.com/1set/starcli/config.GitSummary={{ .Version }}
# GitSummary uses the full tag (e.g. v0.1.2), matching `git describe`; the
# GitBranch field is intentionally omitted — a tag build is on a detached
# HEAD, so a "branch" is meaningless there.
- -X github.com/1set/starcli/config.GitSummary={{ .Tag }}
- -X github.com/1set/starcli/config.GitCommit={{ .ShortCommit }}
- -X github.com/1set/starcli/config.GitBranch={{ .Branch }}
- -X github.com/1set/starcli/config.GoVersion={{ .Env.GOVERSION }}
- -X github.com/1set/starcli/config.BuildDate={{ .Date }}

archives:
Expand Down
31 changes: 19 additions & 12 deletions config/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ package config
import (
_ "embed"
"fmt"
"math/rand"
"runtime"
"strings"

cl "bitbucket.org/ai69/colorlogo"
)

// revive:disable:exported
Expand All @@ -24,11 +27,25 @@ var (
logoArt string
)

// logoGradients is a set of colorlogo colour-scheme presets; DisplayBuildInfo
// picks one at random each run, so the banner shows a different palette on every
// launch.
var logoGradients = []func(string) string{
cl.OceanSandByColumn,
cl.AnamnisarByColumn,
cl.IbizaSunsetByColumn,
cl.PurpleParadiseByColumn,
cl.RainbowBlueByColumn,
cl.EveningNightByColumn,
cl.SublimeVividByColumn,
cl.CherryBlossomsByColumn,
}

// DisplayBuildInfo prints the build information to the console.
func DisplayBuildInfo() {
// write logo
// write the logo with a randomly chosen colour scheme
var sb strings.Builder
sb.WriteString(colorizeLogo(logoArt))
sb.WriteString(logoGradients[rand.Intn(len(logoGradients))](logoArt))
sb.WriteString("\n")

// inline helpers
Expand All @@ -52,13 +69,3 @@ func DisplayBuildInfo() {

fmt.Println(sb.String())
}

// colorizeLogo renders the logo art with a per-line ANSI 256-colour gradient.
func colorizeLogo(art string) string {
palette := []int{45, 44, 43, 49, 48, 84, 78, 79} // teal → green gradient
var sb strings.Builder
for i, line := range strings.Split(strings.TrimRight(art, "\n"), "\n") {
fmt.Fprintf(&sb, "\x1b[38;5;%dm%s\x1b[0m\n", palette[i%len(palette)], line)
}
return sb.String()
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/1set/starcli
go 1.25.8

require (
bitbucket.org/ai69/colorlogo v0.1.3
github.com/1set/starbox v0.2.0
github.com/1set/starlet v0.2.2
github.com/kyokomi/emoji/v2 v2.2.13
Expand Down Expand Up @@ -31,7 +32,6 @@ require (
)

require (
bitbucket.org/ai69/colorlogo v0.1.3 // indirect
bitbucket.org/creachadair/shell v0.0.8 // indirect
charm.land/bubbles/v2 v2.0.0 // indirect
charm.land/bubbletea/v2 v2.0.2 // indirect
Expand Down
Loading