Skip to content

Commit 694b4f8

Browse files
authored
Merge pull request #31 from YaRissi/go-install
feat: installable via go
2 parents aa1bda4 + d8cf7a5 commit 694b4f8

File tree

12 files changed

+60
-30
lines changed

12 files changed

+60
-30
lines changed

.air.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ tmp_dir = "tmp"
55
[build]
66
args_bin = []
77
bin = "./coolify"
8-
cmd = "go build -o ./coolify ."
8+
cmd = "go build -o ./coolify ./coolify"
99
delay = 1000
1010
exclude_dir = ["assets", "tmp", "vendor", "testdata", ".git", ".conductor"]
1111
exclude_file = []
1212
exclude_regex = ["_test.go"]
1313
exclude_unchanged = false
1414
follow_symlink = false
15-
full_bin = "echo 'Build complete. Binary: ./coolify'"
15+
full_bin = "echo 'Build complete. Binary: ./coolify/coolify'"
1616
include_dir = []
1717
include_ext = ["go", "tpl", "tmpl", "html"]
1818
include_file = []

.github/workflows/release-cli.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,20 @@ jobs:
1010
release-cli:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
13+
- name: Checkout repository
14+
uses: actions/checkout@v5
15+
with:
16+
fetch-depth: 0
17+
1418
- name: Set up Go
1519
uses: actions/setup-go@v5
1620
with:
1721
go-version: stable
18-
-
19-
name: Run GoReleaser
20-
uses: goreleaser/goreleaser-action@v5
22+
23+
- name: Run GoReleaser
24+
uses: goreleaser/goreleaser-action@v6
2125
with:
2226
distribution: goreleaser
23-
version: ${{ env.GITHUB_REF_NAME }}
2427
args: release --clean
2528
workdir: ./
2629
env:

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
coolify-cli
2-
coolify
2+
/coolify
33
config.json
44
.claude
55

66
# Generated documentation (can be regenerated)
77
man/
88
docs/cli/
9+
dist/
910

1011
# Test coverage
1112
coverage.out

.goreleaser.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1+
version: 2
2+
13
before:
24
hooks:
35
- go mod tidy
6+
47
builds:
5-
- binary: coolify
8+
- id: coolify
9+
binary: coolify
10+
flags:
11+
- -trimpath
12+
ldflags:
13+
- -s
14+
- -w
15+
main: ./coolify/main.go
616
goos:
717
- darwin
818
- linux
@@ -11,6 +21,4 @@ builds:
1121
- amd64
1222
- arm64
1323
env:
14-
- CGO_ENABLED=0
15-
# Build all platforms in parallel using all available CPU cores
16-
parallelism: -1
24+
- CGO_ENABLED=0

ARCHITECTURE.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,10 @@ c.httpClient = &http.Client{
550550

551551
```bash
552552
# Local build
553-
go build -o coolify .
553+
go build -o coolify ./coolify
554+
555+
# Install locally
556+
go install ./coolify
554557

555558
# Multi-platform release
556559
goreleaser release --clean

CLAUDE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ All commands in this CLI are wrappers around API endpoints defined in the OpenAP
2121

2222
### Command Structure
2323
The codebase follows Cobra's command pattern with a root command and subcommands:
24-
- Entry point: `main.go` calls `cmd.Execute()`
24+
- Entry point: `coolify/main.go` calls `cmd.Execute()`
2525
- Root command: `cmd/root.go` - contains core utilities (HTTP client, authentication, version checking, config management)
2626
- Subcommands: Each command is in its own file in `cmd/`:
2727
- `context.go` - manage Coolify context (add, remove, list, set default/token)
@@ -62,23 +62,23 @@ Three output modes supported via `--format` flag:
6262

6363
### Build
6464
```bash
65-
go build -o coolify .
65+
go build -o coolify ./coolify
6666
```
6767

6868
### Run locally
6969
```bash
70-
go run main.go [command]
70+
go run ./coolify [command]
7171
```
7272

7373
### Test a command
7474
```bash
75-
go run main.go instances list
76-
go run main.go servers list --debug
75+
go run ./coolify context list
76+
go run ./coolify servers list --debug
7777
```
7878

7979
### Install locally
8080
```bash
81-
go install
81+
go install ./coolify
8282
```
8383

8484
### Run tests

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ git clone https://github.com/YOUR_USERNAME/coolify-cli.git
3737
cd coolify-cli
3838

3939
# Build the CLI
40-
go build -o coolify .
40+
go build -o coolify ./coolify
4141

4242
# Install locally
4343
go install
@@ -47,14 +47,14 @@ go install
4747

4848
```bash
4949
# Run without installing
50-
go run main.go [command]
50+
go run ./coolify [command]
5151

5252
# Example commands
53-
go run main.go context list
54-
go run main.go server list --debug
53+
go run ./coolify context list
54+
go run ./coolify server list --debug
5555

5656
# With flags
57-
go run main.go server list --format json --debug
57+
go run ./coolify server list --format json --debug
5858
```
5959

6060
### Project Structure

HOW-TO-RELEASE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Once you publish the release:
6969
4. The release becomes available at:
7070
- GitHub: `https://github.com/coollabsio/coolify-cli/releases/tag/v1.x.x`
7171
- Install script: `curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash`
72+
- `go install`: `go install github.com/coollabsio/coolify-cli/coolify@v1.x.x`
7273

7374
### 5. Verify the Release
7475

@@ -128,10 +129,11 @@ After creating a release:
128129

129130
The release process uses these configuration files:
130131

131-
- `.goreleaser.yml` - GoReleaser configuration (build matrix, archives, etc.)
132+
- `.goreleaser.yml` - GoReleaser configuration (build matrix, archives, etc.) - points to `/coolify` as entry point
132133
- `.github/workflows/release-cli.yml` - GitHub Actions workflow
133134
- `scripts/install.sh` - User-facing install script
134135
- `cmd/root.go` - Contains `CliVersion` variable (line 22)
136+
- `coolify/main.go` - Binary entry point for `go install` support
135137

136138
## Notes
137139

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,25 @@
22

33
## Installation
44

5+
### Install script (recommended)
6+
57
```bash
68
curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify-cli/main/scripts/install.sh | bash
79
```
810

911
It will install the CLI in `/usr/local/bin/coolify` and the configuration file in `~/.config/coolify/config.json`
1012

13+
### Using `go install`
14+
15+
```bash
16+
go install github.com/coollabsio/coolify-cli/coolify@latest
17+
```
18+
19+
This will install the `coolify` binary in your `$GOPATH/bin` directory (usually `~/go/bin`). Make sure this directory is in your `$PATH`.
20+
21+
### Using the install script
22+
23+
1124
## Getting Started
1225
1. Get a `<token>` from your Coolify dashboard (Cloud or self-hosted) at `/security/api-tokens`
1326

@@ -457,7 +470,7 @@ This CLI follows a clean architecture with:
457470

458471
```bash
459472
# Build
460-
go build -o coolify .
473+
go build -o coolify ./coolify
461474

462475
# Run tests
463476
go test ./...
@@ -466,7 +479,7 @@ go test ./...
466479
go test -cover ./...
467480

468481
# Install locally
469-
go install
482+
go install ./coolify
470483
```
471484

472485
## Contributing

conductor-setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ fi
4747

4848
# Build the binary
4949
echo "🔨 Building coolify binary..."
50-
if ! go build -o coolify .; then
50+
if ! go build -o coolify ./coolify; then
5151
echo "❌ Error: Build failed"
5252
exit 1
5353
fi
5454

55-
echo "✅ Binary built successfully: ./coolify"
55+
echo "✅ Binary built successfully: ./coolify/coolify"
5656
echo "🎉 Workspace setup complete!"
5757
echo "🔥 Use the run script for hot reload during development"

0 commit comments

Comments
 (0)