Skip to content

Commit 2c2a2c7

Browse files
mchmarnyclaude
andcommitted
fix: install ko and crane from binary releases
go install puts binaries in $GOPATH/bin which isn't in PATH for subsequent steps/jobs. Install from binary releases to /usr/local/bin instead, matching the pattern used in tools/setup-tools. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 48386c5 commit 2c2a2c7

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

.github/actions/setup-build-tools/action.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,15 @@ runs:
4545
shell: bash
4646
run: |
4747
set -euo pipefail
48-
go install github.com/google/ko@latest
49-
echo "ko installed: $(ko version 2>&1 || echo 'latest')"
48+
# Install ko from binary release (go install puts in GOPATH which isn't in PATH)
49+
KO_VERSION="0.18.0" # From .versions.yaml
50+
KO_URL="https://github.com/ko-build/ko/releases/download/v${KO_VERSION}/ko_${KO_VERSION}_Linux_x86_64.tar.gz"
51+
KO_TMP="$(mktemp -d)"
52+
curl -fsSL "$KO_URL" | tar -xzC "$KO_TMP"
53+
sudo mv "$KO_TMP/ko" /usr/local/bin/ko
54+
sudo chmod +x /usr/local/bin/ko
55+
rm -rf "$KO_TMP"
56+
echo "ko installed: $(ko version)"
5057
5158
- name: Install Syft
5259
if: inputs.install_syft == 'true'
@@ -57,7 +64,17 @@ runs:
5764
shell: bash
5865
run: |
5966
set -euo pipefail
60-
go install github.com/google/go-containerregistry/cmd/crane@${{ inputs.crane_version }}
67+
# Install crane from binary release (go install puts in GOPATH which isn't in PATH)
68+
# Strip 'v' prefix for URL construction
69+
CRANE_VERSION="${{ inputs.crane_version }}"
70+
CRANE_VERSION="${CRANE_VERSION#v}"
71+
CRANE_URL="https://github.com/google/go-containerregistry/releases/download/v${CRANE_VERSION}/go-containerregistry_Linux_x86_64.tar.gz"
72+
CRANE_TMP="$(mktemp -d)"
73+
curl -fsSL "$CRANE_URL" | tar -xzC "$CRANE_TMP"
74+
sudo mv "$CRANE_TMP/crane" /usr/local/bin/crane
75+
sudo chmod +x /usr/local/bin/crane
76+
rm -rf "$CRANE_TMP"
77+
echo "crane installed: $(crane version 2>&1 || echo '${{ inputs.crane_version }}')"
6178
6279
- name: Install GoReleaser
6380
if: inputs.install_goreleaser == 'true'

0 commit comments

Comments
 (0)