distributable:
  url: git+https://github.com/regclient/regclient
  ref: v{{ version }}

versions:
  github: regclient/regclient/releases/tags

provides:
  - bin/regctl

dependencies:
  curl.se/ca-certs: '*'

build:
  dependencies:
    go.dev: ^1.21
    git-scm.org: '*'
  script:
    - make bin/regctl
    - mkdir -p '{{ prefix }}/bin'
    - mv -f ./bin/regctl '{{ prefix }}/bin'

test:
  - regctl version | tee /dev/stderr | grep -q -w "v{{ version }}"
  - OUT="$(regctl image inspect hello-world --platform linux/amd64)"
  - run: echo "$OUT" | grep -q -w '"Image":'
    if: <0.5.6
  - run: echo "$OUT" | grep -q -w '"/hello"'
    if: '>=0.5.6'
