|
| 1 | +# Deployment — CI/CD Design |
| 2 | + |
| 3 | +## Problem |
| 4 | + |
| 5 | +zenodo-cli ships two binaries (`zenodo` + `zenodo-mcp`) and needs to support three install methods: |
| 6 | + |
| 7 | +1. **macOS/Linux**: `curl | bash` one-liner |
| 8 | +2. **Windows**: Scoop package manager |
| 9 | +3. **Manual**: Download from GitHub Releases |
| 10 | + |
| 11 | +The original goreleaser config produced tar.gz/zip archives. This made `curl | bash` impractical (download archive → extract → find binary → move to PATH) and diverged from the pattern established in notion-sync. |
| 12 | + |
| 13 | +## Options Considered |
| 14 | + |
| 15 | +### Option A: Matrix build (notion-sync pattern) |
| 16 | + |
| 17 | +Manual `go build` commands in a GitHub Actions matrix — one job per OS/arch. |
| 18 | + |
| 19 | +```yaml |
| 20 | +strategy: |
| 21 | + matrix: |
| 22 | + include: |
| 23 | + - goos: darwin |
| 24 | + goarch: arm64 |
| 25 | + - goos: linux |
| 26 | + goarch: amd64 |
| 27 | + # ... |
| 28 | +steps: |
| 29 | + - run: go build -o zenodo-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/zenodo |
| 30 | + - run: go build -o zenodo-mcp-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/zenodo-mcp |
| 31 | +``` |
| 32 | +
|
| 33 | +**Pros**: Simple, explicit, identical to notion-sync. |
| 34 | +**Cons**: Verbose CI config. Every new binary = more lines. No auto-changelog. Must manually handle checksums, ldflags, etc. |
| 35 | +
|
| 36 | +### Option B: Goreleaser with archives (original) |
| 37 | +
|
| 38 | +Goreleaser bundles both binaries into tar.gz (Unix) / zip (Windows) per platform. |
| 39 | +
|
| 40 | +**Pros**: Minimal config. Multi-binary is one yaml entry. |
| 41 | +**Cons**: Archives break `curl | bash`. Users must extract before using. Diverges from notion-sync UX. |
| 42 | + |
| 43 | +### Option C: Goreleaser with `format: binary` (chosen) |
| 44 | + |
| 45 | +Goreleaser outputs standalone binaries (no archive wrapping). Names follow `{name}-{os}-{arch}` pattern. |
| 46 | + |
| 47 | +**Pros**: Declarative config. Multi-binary support. Auto-changelog. Checksums. Same standalone-binary UX as notion-sync. |
| 48 | +**Cons**: Slightly different from notion-sync's CI internals (goreleaser vs matrix), but identical end result. |
| 49 | + |
| 50 | +## Implementation |
| 51 | + |
| 52 | +### Goreleaser config (`.goreleaser.yaml`) |
| 53 | + |
| 54 | +Two `builds:` entries — one for `zenodo`, one for `zenodo-mcp`. Both use `binary: {name}-{{ .Os }}-{{ .Arch }}` naming. Archives section set to `format: binary` so no tar.gz/zip wrapping. |
| 55 | + |
| 56 | +### Release workflow (`.github/workflows/release.yml`) |
| 57 | + |
| 58 | +Triggered on `v*` tags. Runs goreleaser, then updates the Scoop manifest with checksums for both `.exe` files and commits to main. |
| 59 | + |
| 60 | +### Install script (`scripts/install.sh`) |
| 61 | + |
| 62 | +Detects OS/arch, downloads both `zenodo` and `zenodo-mcp` binaries from the latest GitHub release, installs to `/usr/local/bin`. Uses `sudo` only if needed. |
| 63 | + |
| 64 | +### Scoop manifest (`bucket/zenodo-cli.json`) |
| 65 | + |
| 66 | +Downloads both `.exe` files. Uses an `installer` script to rename from `zenodo-windows-amd64.exe` → `zenodo.exe` (and same for mcp). Both listed in `bin` array. |
| 67 | + |
| 68 | +## Release artifacts |
| 69 | + |
| 70 | +Each release produces: |
| 71 | + |
| 72 | +| File | Description | |
| 73 | +|------|-------------| |
| 74 | +| `zenodo-darwin-amd64` | CLI — macOS Intel | |
| 75 | +| `zenodo-darwin-arm64` | CLI — macOS Apple Silicon | |
| 76 | +| `zenodo-linux-amd64` | CLI — Linux x64 | |
| 77 | +| `zenodo-linux-arm64` | CLI — Linux ARM | |
| 78 | +| `zenodo-windows-amd64.exe` | CLI — Windows x64 | |
| 79 | +| `zenodo-windows-arm64.exe` | CLI — Windows ARM | |
| 80 | +| `zenodo-mcp-darwin-amd64` | MCP server — macOS Intel | |
| 81 | +| `zenodo-mcp-darwin-arm64` | MCP server — macOS Apple Silicon | |
| 82 | +| `zenodo-mcp-linux-amd64` | MCP server — Linux x64 | |
| 83 | +| `zenodo-mcp-linux-arm64` | MCP server — Linux ARM | |
| 84 | +| `zenodo-mcp-windows-amd64.exe` | MCP server — Windows x64 | |
| 85 | +| `zenodo-mcp-windows-arm64.exe` | MCP server — Windows ARM | |
| 86 | +| `checksums.txt` | SHA-256 checksums for all files | |
0 commit comments