|
| 1 | +# .goreleaser.yaml: build the release artifacts and hang them off the GitHub |
| 2 | +# release that scripts/release.sh already created. |
| 3 | +# |
| 4 | +# The division of labour matters. release.sh owns the version (flake.nix), the |
| 5 | +# annotated tag, and the hand-written notes; it pushes the tag and creates the |
| 6 | +# release. This file owns nothing but bytes: cross-compiled binaries, archives, |
| 7 | +# checksums, and the Homebrew formula. Everything below is downstream of a tag |
| 8 | +# that already exists. |
| 9 | +# |
| 10 | +# goreleaser check # validate this file |
| 11 | +# goreleaser build --snapshot --clean # local binaries, no tag needed |
| 12 | +# goreleaser release --clean # what CI runs on a v* tag push |
| 13 | +version: 2 |
| 14 | + |
| 15 | +project_name: figaro |
| 16 | + |
| 17 | +before: |
| 18 | + hooks: |
| 19 | + - go mod download |
| 20 | + |
| 21 | +builds: |
| 22 | + - id: figaro |
| 23 | + main: ./cmd/figaro |
| 24 | + binary: figaro |
| 25 | + env: |
| 26 | + # One static binary (agents.md invariant #11). CGO would drag in the |
| 27 | + # host libc and make the linux archives useless on musl systems. |
| 28 | + - CGO_ENABLED=0 |
| 29 | + goos: [linux, darwin, windows] |
| 30 | + goarch: [amd64, arm64] |
| 31 | + # Reproducibility: without this the linker stamps the wall clock into |
| 32 | + # every binary, so two builds of the same tag hash differently and a |
| 33 | + # user cannot check our checksums against their own build. |
| 34 | + mod_timestamp: "{{ .CommitTimestamp }}" |
| 35 | + flags: |
| 36 | + - -trimpath |
| 37 | + ldflags: |
| 38 | + - -s -w |
| 39 | + # The same three symbols flake.nix stamps, so a brew/curl figaro |
| 40 | + # reports exactly what a nix figaro reports. semver carries NO leading |
| 41 | + # v: goreleaser's .Version is already stripped, trimprefix is belt and |
| 42 | + # braces for the snapshot/nightly paths where it is not. |
| 43 | + - -X github.com/jack-work/figaro/internal/cli.semver={{ trimprefix .Version "v" }} |
| 44 | + - -X github.com/jack-work/figaro/internal/cli.commit={{ .FullCommit }} |
| 45 | + # Release builds run on a clean checkout, so the honest value is empty. |
| 46 | + # A dirty tree only ever happens under --snapshot, and saying so keeps |
| 47 | + # a locally-built snapshot from impersonating a release. |
| 48 | + - -X github.com/jack-work/figaro/internal/cli.commitDirty={{ if .IsGitDirty }}true{{ end }} |
| 49 | + |
| 50 | +archives: |
| 51 | + - id: figaro |
| 52 | + ids: [figaro] |
| 53 | + # No share/figaro/skills tree: the first-party skills are embedded in the |
| 54 | + # binary, so an archive is one executable plus the paperwork. Single file |
| 55 | + # install is the whole point of this distribution path. |
| 56 | + name_template: figaro_{{ .Version }}_{{ .Os }}_{{ .Arch }} |
| 57 | + formats: [tar.gz] |
| 58 | + format_overrides: |
| 59 | + # Windows has no tar in the shells people actually use to unpack this. |
| 60 | + - goos: windows |
| 61 | + formats: [zip] |
| 62 | + files: |
| 63 | + - LICENSE |
| 64 | + - README.md |
| 65 | + |
| 66 | +checksum: |
| 67 | + name_template: checksums.txt |
| 68 | + algorithm: sha256 |
| 69 | + |
| 70 | +snapshot: |
| 71 | + # Snapshot versions must not look like a real release when they land in |
| 72 | + # `figaro --version`. The -snapshot suffix is the tell. |
| 73 | + version_template: "{{ incpatch .Version }}-snapshot" |
| 74 | + |
| 75 | +changelog: |
| 76 | + # release.sh writes the notes by hand from the annotated tag message. |
| 77 | + # Nothing here should generate a competing changelog. |
| 78 | + disable: true |
| 79 | + |
| 80 | +release: |
| 81 | + github: |
| 82 | + owner: jack-work |
| 83 | + name: figaro |
| 84 | + # THE IMPORTANT LINE. release.sh has already created the release with prose |
| 85 | + # notes taken from the tag. The default mode (replace) would overwrite that |
| 86 | + # body with goreleaser's own; `keep-existing` uploads the assets and leaves |
| 87 | + # the notes exactly as written. If the release does not exist yet (someone |
| 88 | + # pushed a tag without release.sh), goreleaser still creates it. |
| 89 | + mode: keep-existing |
| 90 | + |
| 91 | +# A cask, not a formula. `brews:` is deprecated as of goreleaser 2.10 and |
| 92 | +# `goreleaser check` now FAILS on it, so a formula is no longer a validated |
| 93 | +# option here. The cost, stated plainly: casks are macOS-only, so Linux |
| 94 | +# Homebrew users take install.sh or nix instead of `brew install`. |
| 95 | +homebrew_casks: |
| 96 | + - name: figaro |
| 97 | + ids: [figaro] |
| 98 | + binaries: [figaro] |
| 99 | + repository: |
| 100 | + owner: jack-work |
| 101 | + name: homebrew-tap |
| 102 | + branch: main |
| 103 | + # A token with write access to the tap repo, created by hand and stored |
| 104 | + # as the HOMEBREW_TAP_TOKEN secret. The workflow's default GITHUB_TOKEN |
| 105 | + # is scoped to this repo and cannot push to jack-work/homebrew-tap. |
| 106 | + token: "{{ .Env.HOMEBREW_TAP_TOKEN }}" |
| 107 | + homepage: https://figar.org |
| 108 | + description: A coding agent with few opinions, firmly held. |
| 109 | + license: MIT |
| 110 | + commit_author: |
| 111 | + name: figaro-release |
| 112 | + email: releases@figar.org |
| 113 | + commit_msg_template: "figaro {{ .Version }}" |
| 114 | + # Completions are generated by running the binary we just staged, so they |
| 115 | + # can never drift from it. Same trick flake.nix pulls in postInstall. |
| 116 | + generate_completions_from_executable: |
| 117 | + executable: figaro |
| 118 | + args: [completion] |
| 119 | + shells: [bash, zsh, fish] |
| 120 | + hooks: |
| 121 | + post: |
| 122 | + # `fig` is a pure rename, not an argv rewrite: main.go reads |
| 123 | + # filepath.Base(os.Args[0]), so help and completions come out under |
| 124 | + # whichever name was typed. A cask has no bin.install_symlink, so the |
| 125 | + # alias is made by hand next to the binary brew just linked. |
| 126 | + install: | |
| 127 | + # The binary is not signed or notarized, and Homebrew quarantines |
| 128 | + # what it downloads. On Apple Silicon a quarantined unsigned binary |
| 129 | + # is killed on sight, so the xattr has to come off before the first |
| 130 | + # run rather than after the first confusing crash. |
| 131 | + system_command "/usr/bin/xattr", |
| 132 | + args: ["-dr", "com.apple.quarantine", "#{staged_path}/figaro"], |
| 133 | + must_succeed: false |
| 134 | + fig = "#{HOMEBREW_PREFIX}/bin/fig" |
| 135 | + File.delete(fig) if File.symlink?(fig) || File.exist?(fig) |
| 136 | + File.symlink("#{HOMEBREW_PREFIX}/bin/figaro", fig) |
| 137 | + uninstall: | |
| 138 | + fig = "#{HOMEBREW_PREFIX}/bin/fig" |
| 139 | + File.delete(fig) if File.symlink?(fig) |
| 140 | + caveats: | |
| 141 | + Also installed as `fig`. If a daemon from an older figaro is running, |
| 142 | + restart it: figaro stop |
0 commit comments