From c5b0ad4218c89314a85393c0dce5bf8982e88948 Mon Sep 17 00:00:00 2001 From: Yassir Elmarissi <53705290+YaRissi@users.noreply.github.com> Date: Fri, 17 Oct 2025 11:29:04 +0000 Subject: [PATCH] feat: installable via go and update gorealeser --- .gitignore | 2 +- .goreleaser.yml | 11 +++++++---- ARCHITECTURE.md | 5 ++++- CLAUDE.md | 12 ++++++------ HOW-TO-RELEASE.md | 4 +++- README.md | 11 +++++++++++ main.go => coolify/main.go | 0 internal/version/checker.go | 2 +- 8 files changed, 33 insertions(+), 14 deletions(-) rename main.go => coolify/main.go (100%) diff --git a/.gitignore b/.gitignore index 62b3796..629e96e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ coolify-cli -coolify +/coolify config.json .claude diff --git a/.goreleaser.yml b/.goreleaser.yml index 102ca24..1d940a5 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,8 +1,13 @@ +version: 2 + before: hooks: - go mod tidy + builds: - - binary: coolify + - id: coolify + binary: coolify + main: ./coolify goos: - darwin - linux @@ -11,6 +16,4 @@ builds: - amd64 - arm64 env: - - CGO_ENABLED=0 - # Build all platforms in parallel using all available CPU cores - parallelism: -1 \ No newline at end of file + - CGO_ENABLED=0 \ No newline at end of file diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 7b087b7..bce1ffe 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -550,7 +550,10 @@ c.httpClient = &http.Client{ ```bash # Local build -go build -o coolify . +go build -o coolify ./coolify + +# Install locally +go install ./coolify # Multi-platform release goreleaser release --clean diff --git a/CLAUDE.md b/CLAUDE.md index 606d9a4..c764cc5 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -21,7 +21,7 @@ All commands in this CLI are wrappers around API endpoints defined in the OpenAP ### Command Structure The codebase follows Cobra's command pattern with a root command and subcommands: -- Entry point: `main.go` calls `cmd.Execute()` +- Entry point: `coolify/main.go` calls `cmd.Execute()` - Root command: `cmd/root.go` - contains core utilities (HTTP client, authentication, version checking, config management) - Subcommands: Each command is in its own file in `cmd/`: - `context.go` - manage Coolify context (add, remove, list, set default/token) @@ -62,23 +62,23 @@ Three output modes supported via `--format` flag: ### Build ```bash -go build -o coolify . +go build -o coolify ./coolify ``` ### Run locally ```bash -go run main.go [command] +go run ./coolify [command] ``` ### Test a command ```bash -go run main.go instances list -go run main.go servers list --debug +go run ./coolify context list +go run ./coolify servers list --debug ``` ### Install locally ```bash -go install +go install ./coolify ``` ### Run tests diff --git a/HOW-TO-RELEASE.md b/HOW-TO-RELEASE.md index 953488a..5697471 100644 --- a/HOW-TO-RELEASE.md +++ b/HOW-TO-RELEASE.md @@ -69,6 +69,7 @@ Once you publish the release: 4. The release becomes available at: - GitHub: `https://github.com/coollabsio/coolify-cli/releases/tag/v1.x.x` - Install script: `curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash` + - `go install`: `go install github.com/coollabsio/coolify-cli/coolify@v1.x.x` ### 5. Verify the Release @@ -128,10 +129,11 @@ After creating a release: The release process uses these configuration files: -- `.goreleaser.yml` - GoReleaser configuration (build matrix, archives, etc.) +- `.goreleaser.yml` - GoReleaser configuration (build matrix, archives, etc.) - points to `/coolify` as entry point - `.github/workflows/release-cli.yml` - GitHub Actions workflow - `scripts/install.sh` - User-facing install script - `cmd/root.go` - Contains `CliVersion` variable (line 22) +- `coolify/main.go` - Binary entry point for `go install` support ## Notes diff --git a/README.md b/README.md index 6e5fd3b..e2ab288 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,17 @@ curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify-cli/main/scripts It will install the CLI in `/usr/local/bin/coolify` and the configuration file in `~/.config/coolify/config.json` +### Using `go install` + +```bash +go install github.com/coollabsio/coolify-cli/coolify@latest +``` + +This will install the `coolify` binary in your `$GOPATH/bin` directory (usually `~/go/bin`). Make sure this directory is in your `$PATH`. + +### Using the install script + + ## Getting Started 1. Get a `` from your Coolify dashboard (Cloud or self-hosted) at `/security/api-tokens` diff --git a/main.go b/coolify/main.go similarity index 100% rename from main.go rename to coolify/main.go diff --git a/internal/version/checker.go b/internal/version/checker.go index 8bdc73b..2cecb7b 100644 --- a/internal/version/checker.go +++ b/internal/version/checker.go @@ -14,7 +14,7 @@ import ( ) // CliVersion is the CLI version -const CliVersion = "1.0.3" +const CliVersion = "1.0.4" // CheckInterval for version checking const CheckInterval = 10 * time.Minute