Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 168 additions & 0 deletions .github/workflows/release-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
name: Release CLI

on:
release:
types: [published]

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: Build ${{ matrix.platform.target }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
arch: x86_64
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
arch: aarch64
- target: riscv64gc-unknown-linux-gnu
os: ubuntu-latest
arch: riscv64gc
Comment on lines +24 to +26
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify install-cli.py architecture detection
rg -n "aarch64|arm64|x86_64|riscv" scripts/install-cli.py

Repository: FarisZR/komodo-agentic-cli

Length of output: 231


🏁 Script executed:

#!/bin/bash
# Find and examine the documentation file
fd -i "cli.mdx" docsite/

Repository: FarisZR/komodo-agentic-cli

Length of output: 100


🏁 Script executed:

#!/bin/bash
# Check what the documentation says about supported architectures
rg -A 5 -B 5 "x86_64|aarch64|arm64|architecture|platform" docsite/docs/ecosystem/cli.mdx 2>/dev/null | head -50

Repository: FarisZR/komodo-agentic-cli

Length of output: 382


🏁 Script executed:

#!/bin/bash
# Check the full install-cli.py to understand the context
cat -n scripts/install-cli.py | head -80

Repository: FarisZR/komodo-agentic-cli

Length of output: 2545


🏁 Script executed:

#!/bin/bash
# Check the full release-cli.yml to see how riscv64gc is used
cat -n .github/workflows/release-cli.yml | head -100

Repository: FarisZR/komodo-agentic-cli

Length of output: 3823


🏁 Script executed:

#!/bin/bash
# Search for any artifact upload or release logic that might include riscv64gc
rg -n "riscv64|artifact|upload|release" .github/workflows/release-cli.yml

Repository: FarisZR/komodo-agentic-cli

Length of output: 1277


Update install-cli.py and documentation to support riscv64gc binaries.

The release workflow publishes riscv64gc binaries (lines 24-26, 64-65, 100-101), but scripts/install-cli.py only supports x86_64 and aarch64. Additionally, docsite/docs/ecosystem/cli.mdx only documents x86_64 / aarch64 support. Users on RISC-V systems cannot use the install script and have no documented download path.

Recommended fixes:

  • Update install-cli.py to detect and support riscv64 architecture
  • Update cli.mdx to document RISC-V support (either as fully supported or note the manual download requirement)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-cli.yml around lines 24 - 26, The release workflow
now publishes riscv64gc binaries but install-cli.py only recognizes x86_64 and
aarch64 and cli.mdx only documents those two; update scripts/install-cli.py to
detect RISC-V (check platform.machine() values like "riscv64" and "riscv64gc" or
uname -m), add a riscv mapping to the supported_archs/architecture selection
logic and the download URL/asset-name construction (the same place that handles
"x86_64"/"aarch64"), and ensure the installer falls back with a clear message if
the binary is unavailable; also update docsite/docs/ecosystem/cli.mdx to include
riscv64/riscv64gc as a supported or explicitly documented manual-download option
with the correct filename/URL pattern so RISC-V users know where to get the
binary.


steps:
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform.target }}

- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross --tag v0.2.5

- name: Build
run: cross build --release --bin km --target ${{ matrix.platform.target }}
Comment on lines +39 to +40
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if this is a workspace and if km binary is unique
cat Cargo.toml | head -20
echo "---"
# Find all Cargo.toml files that define a binary named km
rg -l '\[\[bin\]\]' --type toml | xargs -I{} sh -c 'echo "=== {} ===" && rg -A2 "name\s*=\s*\"km\"" {}'

Repository: FarisZR/komodo-agentic-cli

Length of output: 553


🏁 Script executed:

cat bin/cli/Cargo.toml | head -30

Repository: FarisZR/komodo-agentic-cli

Length of output: 770


Consider adding -p komodo_cli to explicitly specify the package in workspace builds.

While --bin km works here since "km" is unique across the workspace, explicitly specifying the package with -p komodo_cli is a best practice that improves clarity and can slightly improve build performance by avoiding unnecessary package searches.

Suggested change
      - name: Build
-        run: cross build --release --bin km --target ${{ matrix.platform.target }}
+        run: cross build --release -p komodo_cli --bin km --target ${{ matrix.platform.target }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-cli.yml around lines 39 - 40, Update the "Build"
step to explicitly specify the package by adding -p komodo_cli to the cross
build invocation: locate the step with name "Build" and the existing command
using --bin km and append -p komodo_cli so the command becomes cross build
--release -p komodo_cli --bin km --target ${{ matrix.platform.target }}; this
makes the workspace build explicit and avoids unnecessary package resolution.


- name: Rename binary
run: |
mv target/${{ matrix.platform.target }}/release/km km-${{ matrix.platform.arch }}

- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: km-${{ matrix.platform.arch }}
path: km-${{ matrix.platform.arch }}

package-deb:
name: DEB ${{ matrix.platform.arch }}
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- arch: x86_64
deb_arch: amd64
- arch: aarch64
deb_arch: arm64
- arch: riscv64gc
deb_arch: riscv64

steps:
- name: Download binary
uses: actions/download-artifact@v4
with:
name: km-${{ matrix.platform.arch }}

- name: Build DEB package
run: |
VERSION="${GITHUB_REF_NAME#v}"
mkdir -p pkg/DEBIAN pkg/usr/bin
chmod +x km-${{ matrix.platform.arch }}
cp km-${{ matrix.platform.arch }} pkg/usr/bin/km
printf 'Package: komodo-cli\nVersion: %s\nSection: utils\nPriority: optional\nArchitecture: %s\nDepends: libc6\nMaintainer: Max Becker <becker.maxh@gmail.com>\nDescription: Komodo CLI\n Command line tool for Komodo deployment management platform.\n Provides the '\''km'\'' binary for interacting with Komodo.\nHomepage: https://komo.do\n' "$VERSION" "${{ matrix.platform.deb_arch }}" > pkg/DEBIAN/control
dpkg-deb --build pkg komodo-cli_${VERSION}_${{ matrix.platform.deb_arch }}.deb
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DEB is built with dpkg-deb --build pkg ... without ensuring root ownership in the package payload. This typically results in files owned by the runner's UID/GID inside the .deb, which is not desirable for system packages. Consider using dpkg-deb --root-owner-group --build pkg ... (or fakeroot) so installed files are owned by root:root.

Suggested change
dpkg-deb --build pkg komodo-cli_${VERSION}_${{ matrix.platform.deb_arch }}.deb
dpkg-deb --root-owner-group --build pkg komodo-cli_${VERSION}_${{ matrix.platform.deb_arch }}.deb

Copilot uses AI. Check for mistakes.
Comment on lines +73 to +80
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider validating VERSION format before building packages.

The VERSION="${GITHUB_REF_NAME#v}" extraction assumes tags follow the v* pattern. If a tag like 1.0.0 (without v prefix) is used, the version will be correct, but if an unexpected tag format is used, the DEB package could have an invalid version string. Debian package versions must follow specific rules (e.g., must start with a digit).

         run: |
           VERSION="${GITHUB_REF_NAME#v}"
+          # Validate version format (must start with digit for Debian)
+          if ! [[ "$VERSION" =~ ^[0-9] ]]; then
+            echo "Error: VERSION '$VERSION' does not start with a digit"
+            exit 1
+          fi
           mkdir -p pkg/DEBIAN pkg/usr/bin
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-cli.yml around lines 73 - 80, Validate the VERSION
extracted from GITHUB_REF_NAME in the "Build DEB package" step by checking that
the VERSION variable matches a Debian-friendly pattern (e.g., starts with a
digit and follows numeric dot-separated segments); if it does not match, print a
clear error and exit before creating the pkg/DEBIAN/control file or calling
dpkg-deb. Update the block that sets VERSION="${GITHUB_REF_NAME#v}" to perform
the regex check on VERSION and fail fast (non-zero exit) or normalize it to a
safe form before using printf to write the control file and running dpkg-deb.


- name: Upload DEB artifact
uses: actions/upload-artifact@v4
with:
name: komodo-cli_${{ matrix.platform.deb_arch }}.deb
path: komodo-cli_*_${{ matrix.platform.deb_arch }}.deb

package-rpm:
name: RPM ${{ matrix.platform.arch }}
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- arch: x86_64
rpm_arch: x86_64
- arch: aarch64
rpm_arch: aarch64
- arch: riscv64gc
rpm_arch: riscv64

steps:
- name: Download binary
uses: actions/download-artifact@v4
with:
name: km-${{ matrix.platform.arch }}

- name: Install rpm tools
run: sudo apt-get update && sudo apt-get install -y rpm

- name: Build RPM package
run: |
VERSION="${GITHUB_REF_NAME#v}"
RELEASE="1"
chmod +x km-${{ matrix.platform.arch }}
RPM_ARCH=${{ matrix.platform.rpm_arch }}
BUILDROOT=komodo-cli-${VERSION}-${RELEASE}.${RPM_ARCH}

mkdir -p ~/rpmbuild/{SOURCES,SPECS,BUILD,RPMS}
mkdir -p ~/rpmbuild/BUILDROOT/${BUILDROOT}/usr/bin
cp km-${{ matrix.platform.arch }} ~/rpmbuild/BUILDROOT/${BUILDROOT}/usr/bin/km
chmod +x ~/rpmbuild/BUILDROOT/${BUILDROOT}/usr/bin/km

CHANGELOG_DATE=$(date '+%a %b %d %Y')
printf 'Name: komodo-cli\nVersion: %s\nRelease: %s%%{?dist}\nSummary: Komodo CLI - command line tool for Komodo\n\nLicense: GPL-3.0-or-later\nURL: https://komo.do\nSource0: https://github.com/moghtech/komodo\n\nExclusiveArch: %s\n\n%%description\nCommand line tool for Komodo deployment management platform.\nProvides the '\''km'\'' binary for interacting with Komodo.\n\n%%files\n/usr/bin/km\n\n%%changelog\n* %s Komodo <becker.maxh@gmail.com> - %s-%s\n- Release %s\n' "$VERSION" "$RELEASE" "$RPM_ARCH" "$CHANGELOG_DATE" "$VERSION" "$RELEASE" "$VERSION" > ~/rpmbuild/SPECS/komodo-cli.spec

rpmbuild -bb \
--target ${RPM_ARCH} \
--buildroot ~/rpmbuild/BUILDROOT/${BUILDROOT} \
~/rpmbuild/SPECS/komodo-cli.spec
Comment on lines +120 to +131
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Use $HOME instead of ~ for consistent path expansion in scripts.

The tilde (~) expansion is performed by the shell before command execution, but it may not expand consistently in all contexts (e.g., when used in variable assignments followed by command substitution). Using $HOME explicitly is more reliable.

-          mkdir -p ~/rpmbuild/{SOURCES,SPECS,BUILD,RPMS}
-          mkdir -p ~/rpmbuild/BUILDROOT/${BUILDROOT}/usr/bin
-          cp km-${{ matrix.platform.arch }} ~/rpmbuild/BUILDROOT/${BUILDROOT}/usr/bin/km
-          chmod +x ~/rpmbuild/BUILDROOT/${BUILDROOT}/usr/bin/km
+          mkdir -p "$HOME/rpmbuild"/{SOURCES,SPECS,BUILD,RPMS}
+          mkdir -p "$HOME/rpmbuild/BUILDROOT/${BUILDROOT}/usr/bin"
+          cp km-${{ matrix.platform.arch }} "$HOME/rpmbuild/BUILDROOT/${BUILDROOT}/usr/bin/km"
+          chmod +x "$HOME/rpmbuild/BUILDROOT/${BUILDROOT}/usr/bin/km"

And similarly for the spec file path and rpmbuild command.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-cli.yml around lines 120 - 131, Replace all uses
of the tilde (~) with the explicit $HOME environment variable in the rpm build
steps to ensure reliable path expansion: update the mkdir, cp, chmod, printf
redirect (~/rpmbuild/SPECS/komodo-cli.spec) and the rpmbuild command invocations
that reference ~/rpmbuild/BUILDROOT/${BUILDROOT} or ~/rpmbuild/SPECS so they use
$HOME/rpmbuild/... instead; keep the same variables (BUILDROOT, RPM_ARCH,
VERSION, RELEASE, CHANGELOG_DATE) and command names (mkdir, cp, chmod, printf,
rpmbuild) unchanged.


cp ~/rpmbuild/RPMS/${RPM_ARCH}/komodo-cli-*.rpm .

- name: Upload RPM artifact
uses: actions/upload-artifact@v4
with:
name: komodo-cli-${{ matrix.platform.rpm_arch }}.rpm
path: komodo-cli-*.rpm

release:
name: Publish Release Assets
needs: [build, package-deb, package-rpm]
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: false

- name: Flatten artifacts
run: |
mkdir -p release-assets
find artifacts -type f \( \
-name 'km-*' -o \
-name '*.deb' -o \
-name '*.rpm' \
\) -exec cp {} release-assets/ \;
ls -la release-assets/

- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: release-assets/*