feat(setup-trivy)!: automatically determine arch #14
+10
-11
@@ -14,17 +14,8 @@ inputs:
|
|||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
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
|
- shell: bash
|
||||||
|
id: arch
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
case "$(uname -m)" in
|
case "$(uname -m)" in
|
||||||
@@ -36,6 +27,14 @@ runs:
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
echo "ARCH=$ARCH" >> $GITHUB_OUTPUT
|
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
|
- name: Download and install Trivy
|
||||||
if: steps.cache-trivy.outputs.cache-hit != 'true'
|
if: steps.cache-trivy.outputs.cache-hit != 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -46,7 +45,7 @@ runs:
|
|||||||
|
|
||||||
mkdir -p /usr/local/bin
|
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
|
tar -xzf trivy.tar.gz
|
||||||
chmod +x trivy
|
chmod +x trivy
|
||||||
mv trivy /usr/local/bin/
|
mv trivy /usr/local/bin/
|
||||||
|
|||||||
Reference in New Issue
Block a user