distributable:
  url: git+https://github.com/getsops/sops.git
  ref: ${{version.tag}}

versions:
  github: getsops/sops

build:
  dependencies:
    go.dev: ^1.19
  script:
    - go build $GO_ARGS -ldflags="$LDFLAGS" ./cmd/sops
  env:
    GO_ARGS:
      - -trimpath
      - -o="{{prefix}}/bin/sops"
    LDFLAGS:
      - -s
      - -w
      - -X github.com/getsops/sops/v3/version.Version={{version}}
    linux:
      LDFLAGS:
        - -buildmode=pie

provides:
  - bin/sops

test:
  dependencies:
    gnupg.org: '*'
  script:
    - sops --version | grep {{version}}
    - git clone https://github.com/getsops/sops.git
    - gpg --import sops/pgp/sops_functional_tests_key.asc
    - sops --decrypt sops/example.json > example.dec.json
    - cat example.dec.json | grep 'New York'
  env:
    GPG_HOME: "$(dirname $(which gpg))/../etc/gnupg"