feat(setup-trivy)!: automatically determine arch #14

Merged
t.behrendt merged 4 commits from feat-automatically-select-correct-arch into main 2025-11-08 19:22:31 +01:00
Showing only changes of commit f26a0c4a9a - Show all commits
+10 -11
View File
@@ -14,17 +14,8 @@ inputs:
runs:
using: "composite"
steps:
- name: Cache Trivy binary
id: cache-trivy
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: /usr/local/bin/trivy
key: trivy-${{ inputs.version }}-${{ inputs.architecture }}
restore-keys: |
trivy-${{ inputs.version }}-${{ inputs.architecture }}-
trivy-${{ inputs.version }}-
- shell: bash
id: arch
run: |
set -e
case "$(uname -m)" in
@@ -36,6 +27,14 @@ runs:
;;
esac
echo "ARCH=$ARCH" >> $GITHUB_OUTPUT
- name: Cache Trivy binary
id: cache-trivy
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: /usr/local/bin/trivy
key: trivy-${{ inputs.version }}-${{ steps.arch.outputs.arch }}
restore-keys: |
trivy-${{ inputs.version }}-${{ steps.arch.outputs.arch }}
- name: Download and install Trivy
if: steps.cache-trivy.outputs.cache-hit != 'true'
shell: bash
@@ -46,7 +45,7 @@ runs:
mkdir -p /usr/local/bin
curl -sL "https://github.com/aquasecurity/trivy/releases/download/${VERSION}/trivy_${VERSION#v}_Linux-${ARCH}.tar.gz" -o trivy.tar.gz
curl -sL "https://github.com/aquasecurity/trivy/releases/download/${VERSION}/trivy_${VERSION#v}_Linux-${{ steps.arch.outputs.arch }}.tar.gz" -o trivy.tar.gz
tar -xzf trivy.tar.gz
chmod +x trivy
mv trivy /usr/local/bin/