From 542464fe4c7a14c53222e2fa15e8f1aeb0fc5f3f Mon Sep 17 00:00:00 2001 From: "FarisZR (agent)" <35614734+FarisZR@users.noreply.github.com> Date: Tue, 31 Mar 2026 23:48:34 +0200 Subject: [PATCH 1/3] Add GitHub Actions workflow to build and package km CLI for multiple architectures on release --- .github/workflows/release-cli.yml | 222 ++++++++++++++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 .github/workflows/release-cli.yml diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml new file mode 100644 index 000000000..805219cc1 --- /dev/null +++ b/.github/workflows/release-cli.yml @@ -0,0 +1,222 @@ +name: Release CLI + +on: + release: + types: [published] + +env: + CARGO_TERM_COLOR: always + BINARY_NAME: km + +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 + cross: true + - target: aarch64-unknown-linux-gnu + os: ubuntu-latest + arch: aarch64 + cross: true + - target: riscv64gc-unknown-linux-gnu + os: ubuntu-latest + arch: riscv64gc + cross: true + + 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 + + - name: Build + run: cross build --release --bin km --target ${{ matrix.platform.target }} + + - 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: + - uses: actions/checkout@v4 + + - name: Download binary + uses: actions/download-artifact@v4 + with: + name: km-${{ matrix.platform.arch }} + + - name: Install cargo-deb + run: cargo install cargo-deb + + - 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 + + cat > pkg/DEBIAN/control < + Description: Komodo CLI + Command line tool for Komodo deployment management platform. + Provides the 'km' binary for interacting with Komodo. + Homepage: https://komo.do + EOF + + dpkg-deb --build pkg komodo-cli_${VERSION}_${{ matrix.platform.deb_arch }}.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: + - uses: actions/checkout@v4 + + - 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 }} + + mkdir -p ~/rpmbuild/SOURCES + mkdir -p ~/rpmbuild/SPECS + mkdir -p ~/rpmbuild/BUILD + mkdir -p ~/rpmbuild/RPMS + + mkdir -p ~/rpmbuild/BUILDROOT/komodo-cli-${VERSION}-${RELEASE}.${{ matrix.platform.rpm_arch }}/usr/bin + cp km-${{ matrix.platform.arch }} ~/rpmbuild/BUILDROOT/komodo-cli-${VERSION}-${RELEASE}.${{ matrix.platform.rpm_arch }}/usr/bin/km + chmod +x ~/rpmbuild/BUILDROOT/komodo-cli-${VERSION}-${RELEASE}.${{ matrix.platform.rpm_arch }}/usr/bin/km + + cat > ~/rpmbuild/SPECS/komodo-cli.spec < - ${VERSION}-${RELEASE} + - Release ${VERSION} + EOF + + rpmbuild -bb \ + --target ${{ matrix.platform.rpm_arch }} \ + --buildroot ~/rpmbuild/BUILDROOT/komodo-cli-${VERSION}-${RELEASE}.${{ matrix.platform.rpm_arch }} \ + ~/rpmbuild/SPECS/komodo-cli.spec + + cp ~/rpmbuild/RPMS/${{ matrix.platform.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/* From 7e7531f1b89099a0dd47e2e9c890342b93800caa Mon Sep 17 00:00:00 2001 From: "FarisZR (agent)" <35614734+FarisZR@users.noreply.github.com> Date: Wed, 1 Apr 2026 00:03:35 +0200 Subject: [PATCH 2/3] Fix review findings in release-cli workflow - Remove unused BINARY_NAME env var - Remove unused 'cross: true' from matrix entries - Pin cross install to v0.2.5 tag for reproducibility - Remove unnecessary checkout steps from package-deb/package-rpm jobs - Remove unused cargo-deb install step - Fix DEB control file generation using printf to avoid heredoc indentation - Fix RPM spec generation using printf to avoid heredoc indentation issues - Remove broken %install section and %license LICENSE from RPM spec - Pre-stage binary in BUILDROOT and use %files directly --- .github/workflows/release-cli.yml | 80 +++++-------------------------- 1 file changed, 13 insertions(+), 67 deletions(-) diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 805219cc1..1716b5a5f 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -6,7 +6,6 @@ on: env: CARGO_TERM_COLOR: always - BINARY_NAME: km jobs: build: @@ -19,15 +18,12 @@ jobs: - target: x86_64-unknown-linux-gnu os: ubuntu-latest arch: x86_64 - cross: true - target: aarch64-unknown-linux-gnu os: ubuntu-latest arch: aarch64 - cross: true - target: riscv64gc-unknown-linux-gnu os: ubuntu-latest arch: riscv64gc - cross: true steps: - uses: actions/checkout@v4 @@ -38,7 +34,7 @@ jobs: targets: ${{ matrix.platform.target }} - name: Install cross - run: cargo install cross --git https://github.com/cross-rs/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 }} @@ -69,37 +65,18 @@ jobs: deb_arch: riscv64 steps: - - uses: actions/checkout@v4 - - name: Download binary uses: actions/download-artifact@v4 with: name: km-${{ matrix.platform.arch }} - - name: Install cargo-deb - run: cargo install cargo-deb - - 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 - - cat > pkg/DEBIAN/control < - Description: Komodo CLI - Command line tool for Komodo deployment management platform. - Provides the 'km' binary for interacting with Komodo. - Homepage: https://komo.do - EOF - + printf 'Package: komodo-cli\nVersion: %s\nSection: utils\nPriority: optional\nArchitecture: %s\nDepends: libc6\nMaintainer: Max Becker \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 - name: Upload DEB artifact @@ -124,8 +101,6 @@ jobs: rpm_arch: riscv64 steps: - - uses: actions/checkout@v4 - - name: Download binary uses: actions/download-artifact@v4 with: @@ -139,52 +114,23 @@ jobs: 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 - mkdir -p ~/rpmbuild/SPECS - mkdir -p ~/rpmbuild/BUILD - mkdir -p ~/rpmbuild/RPMS - - mkdir -p ~/rpmbuild/BUILDROOT/komodo-cli-${VERSION}-${RELEASE}.${{ matrix.platform.rpm_arch }}/usr/bin - cp km-${{ matrix.platform.arch }} ~/rpmbuild/BUILDROOT/komodo-cli-${VERSION}-${RELEASE}.${{ matrix.platform.rpm_arch }}/usr/bin/km - chmod +x ~/rpmbuild/BUILDROOT/komodo-cli-${VERSION}-${RELEASE}.${{ matrix.platform.rpm_arch }}/usr/bin/km - - cat > ~/rpmbuild/SPECS/komodo-cli.spec < - ${VERSION}-${RELEASE} - - Release ${VERSION} - EOF + 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 - %s-%s\n- Release %s\n' "$VERSION" "$RELEASE" "$RPM_ARCH" "$CHANGELOG_DATE" "$VERSION" "$RELEASE" "$VERSION" > ~/rpmbuild/SPECS/komodo-cli.spec rpmbuild -bb \ - --target ${{ matrix.platform.rpm_arch }} \ - --buildroot ~/rpmbuild/BUILDROOT/komodo-cli-${VERSION}-${RELEASE}.${{ matrix.platform.rpm_arch }} \ + --target ${RPM_ARCH} \ + --buildroot ~/rpmbuild/BUILDROOT/${BUILDROOT} \ ~/rpmbuild/SPECS/komodo-cli.spec - cp ~/rpmbuild/RPMS/${{ matrix.platform.rpm_arch }}/komodo-cli-*.rpm . + cp ~/rpmbuild/RPMS/${RPM_ARCH}/komodo-cli-*.rpm . - name: Upload RPM artifact uses: actions/upload-artifact@v4 From 0f2d3917dbb6f468ab60e756e69d3d76334b1787 Mon Sep 17 00:00:00 2001 From: "FarisZR (agent)" <35614734+FarisZR@users.noreply.github.com> Date: Wed, 1 Apr 2026 00:54:18 +0200 Subject: [PATCH 3/3] Add riscv64 support to CLI installer and docs --- docsite/docs/ecosystem/cli.mdx | 2 +- scripts/install-cli.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docsite/docs/ecosystem/cli.mdx b/docsite/docs/ecosystem/cli.mdx index 3102676f6..3ecfa78a4 100644 --- a/docsite/docs/ecosystem/cli.mdx +++ b/docsite/docs/ecosystem/cli.mdx @@ -52,7 +52,7 @@ Secret variable values are masked by default. Set `KM_SHOW_SECRETS=true` or `KM_ ## Install -There are binaries available for Linux (`x86_64` / `aarch64`), macOS (Apple silicon), and a distroless image at `ghcr.io/moghtech/komodo-cli`. +There are binaries available for Linux (`x86_64` / `aarch64` / `riscv64`), macOS (Apple silicon), and a distroless image at `ghcr.io/moghtech/komodo-cli`. ### Linux diff --git a/scripts/install-cli.py b/scripts/install-cli.py index c8a642fea..1399ca3ad 100644 --- a/scripts/install-cli.py +++ b/scripts/install-cli.py @@ -49,13 +49,16 @@ def download_binary(args, bin_dir): if os.path.isfile(bin_path): os.remove(bin_path) - km_bin = "km-x86_64" arch = platform.machine().lower() if arch == "aarch64" or arch == "arm64": print("aarch64 detected") km_bin = "km-aarch64" + elif arch in ("riscv64", "riscv64gc"): + print("riscv64 detected") + km_bin = "km-riscv64gc" else: print("using x86_64 binary") + km_bin = "km-x86_64" # download the binary to bin path if os.system(f'curl -f -sSL {args.binary_url}/{args.version}/{km_bin} -o {bin_path}') != 0: