ci: fix build (#231)

This commit is contained in:
6543 2021-06-22 13:12:26 +02:00 committed by GitHub
parent bfc4aa8059
commit b52ef5f270
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View file

@ -48,7 +48,7 @@ pipeline:
commands:
- go get github.com/woodpecker-ci/togo
- (cd web/; go generate ./...)
- ./.drone.sh
- make release
when:
event: [push, tag]

View file

@ -2,6 +2,17 @@ DOCKER_RUN_GO_VERSION=1.16
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./.git/*")
GO_PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
VERSION ?= ${DRONE_TAG}
ifeq ($(VERSION),)
VERSION := $(shell echo ${DRONE_COMMIT_SHA} | head -c 8)
endif
LDFLAGS ?= -extldflags "-static"
ifneq ($(VERSION),)
LDFLAGS := ${LDFLAGS} -X github.com/woodpecker-ci/woodpecker/version.Version=${VERSION}
endif
DOCKER_RUN?=
_with-docker:
$(eval DOCKER_RUN=docker run --rm -v $(shell pwd):/go/src/ -v $(shell pwd)/build:/build -w /go/src golang:$(DOCKER_RUN_GO_VERSION))
@ -62,6 +73,14 @@ build-frontend:
build: build-agent build-server
release-agent:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '${LDFLAGS}' -o release/drone-agent github.com/woodpecker-ci/woodpecker/cmd/drone-agent
release-server:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '${LDFLAGS}' -o release/drone-server github.com/woodpecker-ci/woodpecker/cmd/drone-server
release: release-agent release-server
install:
go install github.com/woodpecker-ci/woodpecker/cmd/drone-agent
go install github.com/woodpecker-ci/woodpecker/cmd/drone-server