# https://github.com/docker-library/official-images/pull/13556#issuecomment-1319181339 🙈
name: 'Shared Bashbrew Action'
description: 'Install the same version of Bashbrew consistently in all other GitHub Actions'
inputs:
  build:
    default: 'host' # or 'docker' or 'none'
runs:
  using: 'composite'
  steps:

    # these two version numbers are intentionally as close together as I could possibly get them because no matter what I tried, GitHub will not allow me to DRY them (can't have any useful variables in `uses:` and can't even have YAML references to steal it in `env:` or something)
    - shell: 'bash -Eeuo pipefail -x {0}'
      run:    echo BASHBREW_VERSION=v0.1.13 >> "$GITHUB_ENV"
    - uses: docker-library/bashbrew@v0.1.13
      if: inputs.build == 'host'

    - run: docker build --pull --tag oisupport/bashbrew:base "https://github.com/docker-library/bashbrew.git#$BASHBREW_VERSION"
      shell: 'bash -Eeuo pipefail -x {0}'
      if: inputs.build == 'docker'
