distributable:
  url: git+https://github.com/project-copacetic/copacetic.git
  ref: ${{version.tag}}

versions:
  github: project-copacetic/copacetic

display-name: copa

build:
  dependencies:
    go.dev: ^1.21
  script:
    go build $ARGS -ldflags="$LDFLAGS"
  env:
    COMMIT: $(git describe --always --abbrev=8 --dirty)
    DATE: $(date -u +%FT%TZ)
    ARGS:
      - -trimpath
      - -o={{prefix}}/bin/copa
    LDFLAGS:
      - -s
      - -w
      - -X github.com/project-copacetic/copacetic/pkg/version.GitVersion={{version.tag}}
      - -X github.com/project-copacetic/copacetic/pkg/version.GitCommit=${COMMIT}
      - -X github.com/project-copacetic/copacetic/pkg/version.BuildDate=${DATE}
      - -X main.version={{version}}
    linux:
      LDFLAGS:
        - -buildmode=pie

provides:
  - bin/copa

test:
  - copa help | grep 'container patching tool'
  - copa --version | grep {{version}}
