distributable:
  url: https://github.com/axllent/mailpit/archive/refs/tags/v{{version}}.tar.gz
  strip-components: 1

versions:
  github: axllent/mailpit
  strip: /^v/

build:
  dependencies:
    go.dev: ^1.20
    nodejs.org: ^18
    npmjs.com: "*"
  script: |
    npm install
    npm run package
    go build -ldflags="$LDFLAGS" -o mailpit
    mkdir -p "{{ prefix }}"/bin
    mv mailpit "{{ prefix }}"/bin
  env:
    CGO_ENABLED: 0
    LDFLAGS:
      - -extldflags=-static
      - -w
      - -s
      - -X=github.com/axllent/mailpit/config.Version=v{{version}}

provides:
  - bin/mailpit

test:
  dependencies:
    gnu.org/grep: "*"
  script:
    mailpit version | grep "v{{version}}"
