dive/.github/actions/bootstrap/action.yaml
2025-03-28 15:16:13 -04:00

44 lines
1.3 KiB
YAML

name: "Bootstrap"
description: "Bootstrap all tools and dependencies"
inputs:
go-version:
description: "Go version to install"
required: true
default: "1.24.x"
cache-key-prefix:
description: "Prefix all cache keys with this value"
required: true
default: "efa04b89c1b1"
bootstrap-apt-packages:
description: "Space delimited list of tools to install via apt"
default: ""
runs:
using: "composite"
steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}
- name: Restore tool cache
id: tool-cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.tmp
key: ${{ inputs.cache-key-prefix }}-${{ runner.os }}-tool-${{ hashFiles('Makefile') }}
- name: (cache-miss) Bootstrap project tools
shell: bash
if: steps.tool-cache.outputs.cache-hit != 'true'
run: make tools
- name: (cache-miss) Bootstrap go dependencies
shell: bash
if: steps.go-mod-cache.outputs.cache-hit != 'true'
run: go mod download -x
- name: Install apt packages
if: inputs.bootstrap-apt-packages != ''
shell: bash
run: |
DEBIAN_FRONTEND=noninteractive sudo apt update && sudo -E apt install -y ${{ inputs.bootstrap-apt-packages }}