The release pipeline added in v2.23.0 had two compounding bugs that caused tag v2.23.0's release run (#172) to fail at the smoke-test step: 1. .goreleaser.yml ldflags injected '-X main.BuildTag={{.Version}}' (plus BuildCommit/BuildDate), but main.go only declares 'var Version = "dev"'. main.BuildTag is not defined anywhere (grep returns zero hits), so the injection was a no-op and shipped binaries kept reporting 'forgejo-mcp dev'. 2. The smoke-test ran '$BIN --help', but cmd.go uses flag.NewFlagSet(..., flag.ExitOnError) with no -help flag defined, so '--help' exited non-zero and the captured banner was the Usage text, not the version line. The regex check then failed for the right reason but the wrong cause. Fix: - Rewrite ldflags to '-X main.Version={{.Version}}' (drop dead BuildCommit/BuildDate symbols; main has no var for them). - Switch smoke-test to '$BIN version', which goes through cmd.isVersionRequest()'s explicit 'version' subcommand handler and prints 'forgejo-mcp <version>' before flag.Parse runs. Verified locally: $ go build -ldflags='-s -w -X main.Version=2.23.1-test' -o /tmp/x . $ /tmp/x version forgejo-mcp 2.23.1-test Closes: forgejo-mcp-hvr Refs: https://codeberg.org/goern/forgejo-mcp/actions/runs/172
48 lines
1.1 KiB
YAML
48 lines
1.1 KiB
YAML
version: 2
|
|
builds:
|
|
- env:
|
|
- CGO_ENABLED=0
|
|
mod_timestamp: '{{ .CommitTimestamp }}'
|
|
flags:
|
|
- -trimpath
|
|
ldflags:
|
|
- '-s -w -X main.Version={{.Version}}'
|
|
goos:
|
|
- linux
|
|
- darwin
|
|
goarch:
|
|
- amd64
|
|
- arm64
|
|
binary: '{{ .ProjectName }}'
|
|
archives:
|
|
- formats: ['tar.gz']
|
|
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
|
|
wrap_in_directory: true
|
|
strip_binary_directory: true
|
|
format_overrides:
|
|
- goos: windows
|
|
formats: ['zip']
|
|
files:
|
|
- LICENSE
|
|
- README.md
|
|
checksum:
|
|
name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt'
|
|
algorithm: sha256
|
|
|
|
# One CycloneDX SBOM per archive via syft. syft must be on PATH; the release
|
|
# workflow installs it before goreleaser runs.
|
|
sboms:
|
|
- id: archives
|
|
artifacts: archive
|
|
documents:
|
|
- '{{ .ArtifactName }}.sbom.cdx.json'
|
|
cmd: syft
|
|
args:
|
|
- scan
|
|
- '$artifact'
|
|
- --output
|
|
- 'cyclonedx-json=$document'
|
|
|
|
gitea_urls:
|
|
api: https://codeberg.org/api/v1
|
|
download: https://codeberg.org
|