Skilllibrary release-binaries

install
source · Clone the upstream repo
git clone https://github.com/merceralex397-collab/skilllibrary
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/merceralex397-collab/skilllibrary "$T" && mkdir -p ~/.claude/skills && cp -r "$T/10-cli-systems-and-ops/release-binaries" ~/.claude/skills/merceralex397-collab-skilllibrary-release-binaries && rm -rf "$T"
manifest: 10-cli-systems-and-ops/release-binaries/SKILL.md
source content

Purpose

Cross-compile binaries for multiple OS/arch targets and automate release publishing with GoReleaser or cargo-dist.

When to use this skill

  • setting up cross-compilation for Go (
    GOOS
    /
    GOARCH
    ) or Rust (
    --target
    )
  • configuring GoReleaser for automated GitHub releases
  • stripping symbols, compressing binaries, or embedding version info
  • publishing release artifacts with checksums and signatures

Do not use this skill when

  • packaging into Homebrew/deb/rpm — prefer
    packaging-installers
  • building Docker images — different workflow
  • the project is a library, not a binary

Procedure

  1. Define target matrix
    linux/amd64
    ,
    linux/arm64
    ,
    darwin/amd64
    ,
    darwin/arm64
    ,
    windows/amd64
    .
  2. Configure GoReleaser — create
    .goreleaser.yaml
    with
    builds
    ,
    archives
    ,
    checksum
    ,
    release
    .
  3. Set ldflags
    -ldflags "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}"
    .
  4. Local build
    goreleaser build --snapshot --clean
    . Check output in
    dist/
    .
  5. CI workflow — GitHub Actions on
    tags: v*
    using
    goreleaser/goreleaser-action@v5
    .
  6. Checksums — GoReleaser auto-generates. Manual:
    sha256sum dist/* > checksums.txt
    .
  7. Sign
    cosign sign-blob
    or GPG on checksums file.
  8. Verify — download each artifact, check checksum, run
    --version
    .

GoReleaser config

version: 2
builds:
  - env: [CGO_ENABLED=0]
    goos: [linux, darwin, windows]
    goarch: [amd64, arm64]
    ldflags: [-s, -w, "-X main.version={{.Version}}"]
archives:
  - format_overrides:
      - goos: windows
        format: zip
checksum:
  name_template: checksums.txt

Rust cross-compilation

rustup target add x86_64-unknown-linux-musl aarch64-unknown-linux-musl
cargo build --release --target x86_64-unknown-linux-musl
strip target/x86_64-unknown-linux-musl/release/mytool

Decision rules

  • CGO_ENABLED=0
    for Go static binaries — avoids glibc issues.
  • musl target for Rust static binaries on Linux.
  • Always include
    sha256
    checksums.
  • -s -w
    (Go) or
    strip
    (Rust) reduces binary size ~30%.
  • Tag as
    v1.2.3
    (semver with
    v
    prefix) — GoReleaser expects this.

References

Related skills

  • packaging-installers
    — Homebrew/deb/rpm packaging
  • cli-development-go
    — building the Go CLI
  • cobra-go
    — command structure for the binary