From b1c0117464ccdf1899a117d06ca0324fc3f8aff0 Mon Sep 17 00:00:00 2001 From: anandgupta42 Date: Tue, 24 Mar 2026 20:31:08 -0700 Subject: [PATCH] fix: install altimate-code from npm instead of GitHub Release binaries The previous approach downloaded standalone binaries from GitHub Releases, which don't include NAPI native dependencies like `@altimateai/altimate-core`. This caused v0.5.10 to silently fail (graceful degradation to regex-only mode). Switch to `npm install -g altimate-code` which is the officially supported install method. npm correctly resolves all dependencies including the platform-specific NAPI binaries via the wrapper package. Benefits: - Matches the documented install method in the README - Automatically gets `@altimateai/altimate-core` and platform binaries - No more architecture/OS detection shell logic - No more GitHub API calls for version resolution - Simpler action.yml (removed ~40 lines of download/extract/cache logic) Trade-off: npm install takes ~10s vs cached binary lookup (~0s on cache hit). The cache step was removed since npm has its own caching and the install is fast enough for CI. Co-Authored-By: Claude Opus 4.6 (1M context) --- action.yml | 62 ++++++------------------------------------------------ 1 file changed, 6 insertions(+), 56 deletions(-) diff --git a/action.yml b/action.yml index 0817864..f619792 100644 --- a/action.yml +++ b/action.yml @@ -93,70 +93,20 @@ outputs: runs: using: "composite" steps: - - name: Get altimate-code version - id: version - shell: bash - run: | - VERSION=$(curl -sf -H "Authorization: Bearer ${{ github.token }}" https://api.github.com/repos/AltimateAI/altimate-code/releases/latest | grep -o '"tag_name": *"[^"]*"' | cut -d'"' -f4) - echo "version=${VERSION:-latest}" >> $GITHUB_OUTPUT - - - name: Cache altimate-code - id: cache - uses: actions/cache@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 with: - path: ~/.altimate-code/bin - key: altimate-code-${{ runner.os }}-${{ runner.arch }}-${{ steps.version.outputs.version }} + node-version: "22" - name: Install altimate-code - if: steps.cache.outputs.cache-hit != 'true' shell: bash run: | - # Download binary directly from GitHub releases - VERSION="${{ steps.version.outputs.version }}" - ARCH=$(uname -m) - OS=$(uname -s | tr '[:upper:]' '[:lower:]') - - # Map architecture names - case "$ARCH" in - x86_64) ARCH="x64" ;; - aarch64|arm64) ARCH="arm64" ;; - esac - - ASSET="altimate-code-${OS}-${ARCH}" - if [ "$OS" = "linux" ]; then - ASSET="${ASSET}.tar.gz" - else - ASSET="${ASSET}.zip" - fi - - DOWNLOAD_URL="https://github.com/AltimateAI/altimate-code/releases/download/${VERSION}/${ASSET}" - echo "Downloading altimate-code ${VERSION} from ${DOWNLOAD_URL}" - - mkdir -p ~/.altimate-code/bin - cd /tmp - if curl -fsSL -o "altimate-code-archive" "$DOWNLOAD_URL"; then - if [ "$OS" = "linux" ]; then - tar xzf altimate-code-archive -C ~/.altimate-code/bin/ 2>/dev/null || true - else - unzip -o altimate-code-archive -d ~/.altimate-code/bin/ 2>/dev/null || true - fi - chmod +x ~/.altimate-code/bin/altimate-code 2>/dev/null || true - rm -f altimate-code-archive - echo "altimate-code installed successfully" + if npm install -g altimate-code 2>/dev/null; then + echo "altimate-code $(altimate-code --version 2>/dev/null || echo 'installed') via npm" else - echo "::warning::Failed to download altimate-code binary — some features may be limited" + echo "::warning::Failed to install altimate-code via npm — some features may be limited" fi - - name: Add altimate-code to PATH - shell: bash - run: | - [ -d "$HOME/.altimate-code/bin" ] && echo "$HOME/.altimate-code/bin" >> $GITHUB_PATH || true - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "22" - - name: Validate model input shell: bash run: |