distributable:
  url: https://github.com/open-policy-agent/conftest/archive/refs/tags/v{{version}}.tar.gz
  strip-components: 1

versions:
  github: open-policy-agent/conftest

build:
  dependencies:
    go.dev: ^1.21
  script: |
    go build -ldflags="$LDFLAGS" -o $BUILDLOC .
  env:
    CGO_ENABLED: 0
    LDFLAGS:
      - -X github.com/open-policy-agent/conftest/internal/commands.version={{version}}
    BUILDLOC: '{{prefix}}/bin/conftest'

provides:
  - bin/conftest

test:
  dependencies:
    gnu.org/grep: '*'
  script: |
    test "$(conftest --version | grep Conftest:)" = "Conftest: {{version}}"
