44 lines
1.6 KiB
YAML
44 lines
1.6 KiB
YAML
name: 'Install SBOM Tools'
|
|
description: 'Installs Trivy and CycloneDX CLI to ~/.local/bin with caching, adds them to PATH'
|
|
author: 'janhouse'
|
|
|
|
inputs:
|
|
trivy-version:
|
|
description: 'Trivy release tag (e.g. v0.70.0). Defaults to ${{ vars.TRIVY_VERSION }} via the caller workflow env.'
|
|
required: true
|
|
cyclonedx-version:
|
|
description: 'CycloneDX CLI release tag (e.g. v0.27.1). Defaults to ${{ vars.CYCLONEDX_CLI_VERSION }} via the caller workflow env.'
|
|
required: true
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Cache SBOM tools
|
|
id: cache-tools
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.local/bin
|
|
key: sbom-tools-${{ runner.os }}-trivy-${{ inputs.trivy-version }}-cyclonedx-${{ inputs.cyclonedx-version }}
|
|
|
|
- name: Install Trivy
|
|
if: steps.cache-tools.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
env:
|
|
TRIVY_VERSION: ${{ inputs.trivy-version }}
|
|
run: |
|
|
mkdir -p ~/.local/bin
|
|
curl -sSfL "https://raw.githubusercontent.com/aquasecurity/trivy/${TRIVY_VERSION}/contrib/install.sh" | sh -s -- -b ~/.local/bin "${TRIVY_VERSION}"
|
|
|
|
- name: Install CycloneDX CLI
|
|
if: steps.cache-tools.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
env:
|
|
CYCLONEDX_CLI_VERSION: ${{ inputs.cyclonedx-version }}
|
|
run: |
|
|
curl -sSfL "https://github.com/CycloneDX/cyclonedx-cli/releases/download/${CYCLONEDX_CLI_VERSION}/cyclonedx-linux-x64" -o ~/.local/bin/cyclonedx-cli
|
|
chmod +x ~/.local/bin/cyclonedx-cli
|
|
|
|
- name: Add tools to PATH
|
|
shell: bash
|
|
run: echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|