Skip to content

Commit bfa6d1b

Browse files
authored
Merge pull request #3 from godon-dev/cli_release_flow
define basic release flow for binary
2 parents c1d025f + de9eada commit bfa6d1b

2 files changed

Lines changed: 223 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Release Godon CLI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Install Nix
19+
uses: cachix/install-nix-action@v25
20+
with:
21+
nix_path: nixpkgs=channel:nixos-25.11
22+
extra_nix_config: |
23+
sandbox = false
24+
sandbox-paths = /etc/ssl/certs/ca-bundle.crt
25+
experimental-features = nix-command flakes
26+
27+
- name: Configure Nix daemon SSL certificates
28+
run: |
29+
# Find and symlink SSL certificates for Nix daemon
30+
sudo mkdir -p /etc/ssl/certs
31+
CERT_BUNDLE=$(find /nix/store -name "ca-bundle.crt" | head -1)
32+
echo "Found certificate bundle: $CERT_BUNDLE"
33+
sudo ln -sf "$CERT_BUNDLE" /etc/ssl/certs/ca-bundle.crt
34+
sudo ln -sf "$CERT_BUNDLE" /etc/ssl/certs/ca-certificates.crt
35+
36+
# Set environment variables for this session
37+
export SSL_CERT_FILE="/etc/ssl/certs/ca-bundle.crt"
38+
export NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-bundle.crt"
39+
export CURL_CA_BUNDLE="/etc/ssl/certs/ca-bundle.crt"
40+
41+
# Add to nix.conf for daemon
42+
echo "ssl-cert-file = /etc/ssl/certs/ca-bundle.crt" | sudo tee -a /etc/nix/nix.conf
43+
44+
echo "SSL certificates configured for Nix daemon"
45+
46+
- name: Extract version from release
47+
id: version
48+
run: |
49+
# Extract version from release tag (e.g., refs/tags/1.0.0 -> 1.0.0)
50+
VERSION="${{ github.ref_name }}"
51+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
52+
53+
# Validate semver format
54+
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\-\.]+)?(\+[a-zA-Z0-9\-\.]+)?$ ]]; then
55+
echo "Error: Release tag must be in semantic versioning format (e.g., 1.0.0, 2.1.3, 1.0.0-alpha.1)"
56+
exit 1
57+
fi
58+
59+
echo "Building version: $VERSION"
60+
61+
- name: Build binary
62+
run: |
63+
export SSL_CERT_FILE="/etc/ssl/certs/ca-bundle.crt"
64+
export NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-bundle.crt"
65+
export CURL_CA_BUNDLE="/etc/ssl/certs/ca-bundle.crt"
66+
67+
# Build with version from release tag
68+
nix --experimental-features "nix-command flakes" build .#godon-cli-custom-${{ steps.version.outputs.VERSION }}
69+
70+
- name: Prepare release assets
71+
run: |
72+
# Get the build output path
73+
OUTPUT_PATH=$(nix --experimental-features "nix-command flakes" path-info .#godon-cli-custom-${{ steps.version.outputs.VERSION }})
74+
75+
# Create release directory
76+
mkdir -p release
77+
78+
# Copy binary with original name inside archive
79+
cp "$OUTPUT_PATH/bin/godon_cli" "release/godon_cli"
80+
81+
# Create compressed archive
82+
cd release
83+
tar -czf "../godon-cli-${{ steps.version.outputs.VERSION }}-x86_64-linux.tar.gz" "godon_cli"
84+
cd ..
85+
86+
echo "Created release asset: godon-cli-${{ steps.version.outputs.VERSION }}-x86_64-linux.tar.gz"
87+
88+
- name: Upload release assets
89+
uses: softprops/action-gh-release@v2
90+
with:
91+
files: |
92+
godon-cli-*.tar.gz
93+
env:
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Godon CLI
2+
3+
A Nim-based CLI tool for controlling and managing the Godon optimizer breeders via the Godon Control API.
4+
5+
## Features
6+
7+
- List, create, show, update, and delete breeder configurations
8+
- YAML-based configuration files
9+
- RESTful API integration
10+
- Cross-platform support (currently Linux x86_64)
11+
12+
## Installation
13+
14+
### Binary Download
15+
16+
Download the latest release from the [GitHub Releases](https://github.com/godon-dev/godon-cli/releases) page:
17+
18+
```bash
19+
# Download and extract (replace VERSION with actual version)
20+
wget https://github.com/godon-dev/godon-cli/releases/download/VERSION/godon-cli-VERSION-x86_64-linux.tar.gz
21+
tar -xzf godon-cli-VERSION-x86_64-linux.tar.gz
22+
23+
# Make executable and move to PATH
24+
chmod +x godon_cli
25+
sudo mv godon_cli /usr/local/bin/
26+
```
27+
28+
### Docker
29+
30+
Docker images are built from the [godon-images](https://github.com/godon-dev/godon-images) repository and include the CLI binary.
31+
32+
## Usage
33+
34+
### Basic Commands
35+
36+
```bash
37+
# Show help
38+
godon_cli --help
39+
40+
# List all breeders
41+
godon_cli breeder list
42+
43+
# Connect to a different API server
44+
godon_cli --hostname api.example.com --port 9090 breeder list
45+
```
46+
47+
### Breeder Management
48+
49+
#### Create a Breeder
50+
51+
Create a YAML configuration file `breeder.yaml`:
52+
53+
```yaml
54+
name: "genetic-optimizer-1"
55+
config: >
56+
{"setting1": "value1", "setting2": 42, "optimization_target": "performance"}
57+
```
58+
59+
Then create the breeder:
60+
61+
```bash
62+
godon_cli breeder create --file breeder.yaml
63+
```
64+
65+
#### Show Breeder Details
66+
67+
```bash
68+
godon_cli breeder show --id 550e8400-e29b-41d4-a716-446655440000
69+
```
70+
71+
#### Update a Breeder
72+
73+
Create an update configuration file `breeder_update.yaml`:
74+
75+
```yaml
76+
uuid: "550e8400-e29b-41d4-a716-446655440000"
77+
name: "updated-genetic-optimizer"
78+
description: "Updated optimizer configuration"
79+
config: >
80+
{"setting1": "new_value1", "setting2": 100}
81+
```
82+
83+
Then update:
84+
85+
```bash
86+
godon_cli breeder update --file breeder_update.yaml
87+
```
88+
89+
#### Delete a Breeder
90+
91+
```bash
92+
godon_cli breeder purge --id 550e8400-e29b-41d4-a716-446655440000
93+
```
94+
95+
## Configuration
96+
97+
The CLI connects to the Godon API using these default settings:
98+
99+
- **Hostname**: `localhost`
100+
- **Port**: `8080`
101+
- **API Version**: `v0`
102+
103+
You can override these using command-line flags:
104+
105+
```bash
106+
godon_cli --hostname api.example.com --port 9090 --api-version v1 breeder list
107+
```
108+
109+
## API Specification
110+
111+
This CLI is designed to work with the [Godon Control API](https://github.com/godon-dev/godon-images) which follows OpenAPI 3.0 specification.
112+
113+
## License
114+
115+
This project is licensed under the GNU Affero General Public License v3.0. See the [LICENSE](LICENSE) file for details.
116+
117+
## Releasing
118+
119+
Releases are automated through GitHub Actions:
120+
121+
1. Create a new release on GitHub with a semantic version tag (e.g., `1.0.0`, `1.0.0-alpha.1`)
122+
2. GitHub Actions will automatically build and upload `godon-cli-VERSION-x86_64-linux.tar.gz`
123+
3. The compressed archive will be available in the release assets
124+
125+
**Version format**: Must follow [Semantic Versioning](https://semver.org/) (e.g., `1.0.0`, `2.1.3`, `1.0.0-alpha.1`, `1.0.0+build.1`)
126+
127+
## Changelog
128+
129+
See the [GitHub Releases](https://github.com/godon-dev/godon-cli/releases) page for version history and changes.

0 commit comments

Comments
 (0)