From 7a8fc166ec935c9a2af458a8631ea8a041431b38 Mon Sep 17 00:00:00 2001 From: Aaron Weiker Date: Thu, 14 May 2026 05:45:20 +0000 Subject: [PATCH] feat(action): derive binary name from uname for multi-arch support (#124) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously the Install step hard-coded 'review-bot-linux-amd64'. This fails on arm64 runners (Graviton, Apple Silicon) where uname -m returns 'aarch64' or 'arm64'. Changes: - Add OS/arch detection in 'Determine version' step using uname -s/-m - Map uname output to asset name format: x86_64→amd64, aarch64/arm64→arm64, linux→linux, darwin→darwin - Emit 'os' and 'arch' as step outputs alongside 'version' - Update cache key: review-bot-{os}-{arch}-{version} - Update Install step: BINARY derived from step outputs - Anchor checksum grep to exact filename (not substring match) - Unsupported OS or arch exits with a clear error message Supported platforms: linux-amd64, linux-arm64, darwin-amd64, darwin-arm64 (matches what the release workflow builds) --- .gitea/actions/review/action.yml | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/.gitea/actions/review/action.yml b/.gitea/actions/review/action.yml index 6f6fed1..456d04d 100644 --- a/.gitea/actions/review/action.yml +++ b/.gitea/actions/review/action.yml @@ -124,14 +124,38 @@ runs: else VERSION="${{ inputs.version }}" fi + + # Detect OS and architecture for platform-specific binary download + OS_RAW=$(uname -s | tr '[:upper:]' '[:lower:]') + case "$OS_RAW" in + linux) OS="linux" ;; + darwin) OS="darwin" ;; + *) + echo "Error: unsupported OS: $(uname -s)" >&2 + exit 1 + ;; + esac + + RAW_ARCH=$(uname -m) + case "$RAW_ARCH" in + x86_64) ARCH="amd64" ;; + aarch64 | arm64) ARCH="arm64" ;; + *) + echo "Error: unsupported architecture: $RAW_ARCH" >&2 + exit 1 + ;; + esac + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "os=${OS}" >> "$GITHUB_OUTPUT" + echo "arch=${ARCH}" >> "$GITHUB_OUTPUT" - name: Cache review-bot binary id: cache uses: actions/cache@v4 with: path: ${{ runner.temp }}/review-bot - key: review-bot-linux-amd64-${{ steps.version.outputs.version }} + key: review-bot-${{ steps.version.outputs.os }}-${{ steps.version.outputs.arch }}-${{ steps.version.outputs.version }} - name: Install review-bot if: steps.cache.outputs.cache-hit != 'true' @@ -140,7 +164,7 @@ runs: GITEA_URL="${{ inputs.gitea-url || github.server_url }}" REPO="${{ inputs.repo || 'rodin/review-bot' }}" VERSION="${{ steps.version.outputs.version }}" - BINARY="review-bot-linux-amd64" + BINARY="review-bot-${{ steps.version.outputs.os }}-${{ steps.version.outputs.arch }}" curl -sSfL "${GITEA_URL}/${REPO}/releases/download/${VERSION}/${BINARY}" \ -o "${{ runner.temp }}/review-bot" @@ -149,7 +173,7 @@ runs: # Verify SHA-256 checksum cd "${{ runner.temp }}" - EXPECTED=$(grep "${BINARY}" checksums.txt | awk '{print $1}') + EXPECTED=$(grep -E "[[:xdigit:]]+[[:space:]]+\*?${BINARY}$" checksums.txt | awk '{print $1}') ACTUAL=$(sha256sum review-bot | awk '{print $1}') if [ -z "$EXPECTED" ]; then @@ -164,7 +188,7 @@ runs: fi chmod +x "${{ runner.temp }}/review-bot" - echo "Installed review-bot ${VERSION} (checksum verified)" + echo "Installed review-bot-${{ steps.version.outputs.os }}-${{ steps.version.outputs.arch }} ${VERSION} (checksum verified)" - name: Run review shell: bash