diff --git a/ci/main.cue b/ci/main.cue index b06fd4c7..af7bde66 100644 --- a/ci/main.cue +++ b/ci/main.cue @@ -1,6 +1,8 @@ package main import ( + "strings" + // "dagger.io/dagger" "dagger.io/dagger/engine" @@ -10,6 +12,10 @@ import ( engine.#Plan & { inputs: { params: { + // FIXME: until we support a better way + os: string | *"darwin" + arch: string | *"amd64" + // FIXME: implement condition actions using params } @@ -32,20 +38,21 @@ engine.#Plan & { build: bash.#Run & { input: images.goBuilder.output + env: { + GOMODCACHE: mounts["go mod cache"].dest + GOOS: strings.ToLower(inputs.params.os) + GOARCH: strings.ToLower(inputs.params.arch) + } + script: contents: #""" - export GOMODCACHE=/gomodcache mkdir -p /build git_revision=$(git rev-parse --short HEAD) - GO_ENABLED=0 \ + CGO_ENABLED=0 \ go build -v -o /build/dagger \ -ldflags '-s -w -X go.dagger.io/dagger/version.Revision='${git_revision} \ ./cmd/dagger/ """# - export: directories: "/build": _ - workdir: "/usr/src/dagger" - env: GOMODCACHE: "/gomodcache" - mounts: { "dagger source code": { contents: inputs.directories.source.contents @@ -59,6 +66,7 @@ engine.#Plan & { } workdir: mounts["dagger source code"].dest + export: directories: "/build": _ } } }