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