Build & Release

sharur uses a combination of Mage and GitHub Actions for CI/CD.


Versioning

The project version is maintained in a VERSION file in the repository root. During build, Magefile.go reads this file and injects it into the binary using linker flags (-ldflags "-X main.version=...").


Mage Targets

TargetDescription
BuildCompile shr for the current platform with version injection
TestRun all unit tests with coverage
VetStatic analysis with go vet
LintRun golangci-lint
VulnVulnerability scan with govulncheck
AllRun generate, build, test, vet, lint, and vuln in sequence
ReleaseCross-compile for Linux, macOS, and Windows (AMD64/ARM64), package into dist/
GenerateRun buf to regenerate protobuf stubs
DocsGenerate API reference (gomarkdoc) and build the Hugo site
DocsServeRun Hugo dev server at localhost:1313 with live reload
PkgSiteRun pkgsite for local full API browsing including internals

CI/CD Pipelines

Continuous Integration (ci.yml)

Triggered on every push to main and all pull requests. Runs mage all within a Nix environment on both ubuntu-latest and macos-latest, then uploads per-platform binaries as build artifacts. Coverage is collected and summarised via go tool cover.

Automated Release (release.yml)

Triggered by pushing a version tag (e.g., v1.2.3). Runs mage release to build cross-platform assets and uses softprops/action-gh-release to publish them to a new GitHub Release.

Docs Deploy (docs.yml)

Triggered on push to main and on published releases. Runs mage docs (gomarkdoc + Hugo build) and deploys docs/public/ to the gh-pages branch via peaceiris/actions-gh-pages.