Vectrum
Sign In
93 lines · 3.0 KB
# Release configuration for goreleaser v2. A tag push runs it through
# .github/workflows/release.yml; `goreleaser release --snapshot --clean` runs
# the same thing locally into dist/ without publishing anything.
version: 2

project_name: codey

before:
  hooks:
    # A go.sum that disagrees with go.mod fails here, before four builds
    # each fail the same way.
    - go mod tidy -diff

builds:
  - id: codey
    main: ./cmd/codey
    binary: codey
    env:
      # Codey has no cgo dependencies, and a static binary is what lets the
      # one linux archive run on any distribution's libc.
      - CGO_ENABLED=0
    goos: [linux, darwin]
    goarch: [amd64, arm64]
    flags:
      # Builder paths stay out of panics and the binary is reproducible.
      - -trimpath
    ldflags:
      # -s -w drops the symbol table and DWARF, which a release has no use
      # for. The version is stamped from the tag; cmd/codey/version.go puts
      # the v back on and says what is used when nothing is stamped.
      - -s -w -X main.version={{.Version}}
    mod_timestamp: "{{ .CommitTimestamp }}"

archives:
  - id: codey
    ids: [codey]
    formats: [tar.gz]
    # No version in the name, so .../releases/latest/download/codey_linux_amd64.tar.gz
    # is a URL the README can print once and that never goes stale. The
    # release a file belongs to already says which version it is, and so
    # does codey --version.
    name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
    files:
      - README.md
      - LICENSE

checksum:
  name_template: checksums.txt
  algorithm: sha256

snapshot:
  version_template: "{{ incpatch .Version }}-SNAPSHOT-{{ .ShortCommit }}"

changelog:
  sort: asc
  use: git
  filters:
    exclude:
      - "^Merge "
      - "^wip"

release:
  github:
    owner: johannSo
    name: codey
  # A tag like v0.7.0-rc.1 is published as a pre-release rather than as the
  # latest, so go install ...@latest and the download page agree.
  prerelease: auto

# Homebrew, once there is a tap to publish to. Create the repository
# johannSo/homebrew-tap, give the release workflow a token that can push to
# it (the default GITHUB_TOKEN is scoped to this repository only) as the
# secret HOMEBREW_TAP_TOKEN, pass it through as an env var in release.yml,
# and uncomment this. `brew install johannSo/tap/codey` then works.
#
# homebrew_casks:
#   - name: codey
#     ids: [codey]
#     repository:
#       owner: johannSo
#       name: homebrew-tap
#       token: "{{ .Env.HOMEBREW_TAP_TOKEN }}"
#     homepage: https://github.com/johannSo/codey
#     description: A coding agent harness, with a TUI and a one-prompt mode.
#     license: MIT
#     # The binaries are not notarized, so Gatekeeper would quarantine the
#     # download; this clears the flag on install.
#     hooks:
#       post:
#         install: |
#           if system_command("/usr/bin/xattr", args: ["-h"]).exit_status == 0
#             system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/codey"]
#           end