requires:
  - name: "toolchain"
    category: "development"
    version: ">=0"
prelude:
  - mkdir -p go/src/github.com/${GITHUB_ORG}/
  - cd go/src/github.com/${GITHUB_ORG}/ && git clone https://github.com/${GITHUB_ORG}/{{ .Values.name }}.git
env:
  - CGO_ENABLED=0
  - GITHUB_ORG={{ ( index .Values.labels "github.owner" ) }}
  - LDFLAGS="-s -w {{with .Values.ldflags}}{{.}}{{end}}"
steps:
  - |
    PACKAGE_VERSION=${PACKAGE_VERSION%\-*} && \
    cd go/src/github.com/${GITHUB_ORG}/{{ .Values.name }}/ && git checkout $PACKAGE_VERSION && \
    go build -ldflags="${LDFLAGS} -X github.com/mudler/luet/cmd.Version=$PACKAGE_VERSION -X github.com/mudler/luet/cmd.BuildTime={{ dateInZone "2006-01-02T15:04:05Z" (now) "UTC" }}" -o {{ .Values.name }} && \
    mv {{ .Values.name }} /usr/bin/
  - /usr/bin/{{ .Values.name }} version
includes:
- /usr/bin/{{.Values.name}}
